versionbits

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2018 License: BSD-2-Clause Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// VersionBitsLastOldBlockVersion what block version to use for new blocks (pre versionBits)
	VersionBitsLastOldBlockVersion = 4
	// VersionBitsTopBits what bits to set in version for versionBits blocks
	VersionBitsTopBits = 0x20000000
	// VersionBitsTopMask What bitMask determines whether versionBits is in use
	VersionBitsTopMask int64 = 0xE0000000
	// VersionBitsNumBits Total bits available for versionBits
	VersionBitsNumBits = 29
)

Variables

View Source
var VersionBitsDeploymentInfo = []BIP9DeploymentInfo{
	{
		Name:     "testdummy",
		GbtForce: true,
	},
	{
		Name:     "csv",
		GbtForce: true,
	},
}

Functions

func ComputeBlockVersion

func ComputeBlockVersion() int32

func VersionBitsMask

func VersionBitsMask(params *model.BitcoinParams, pos consensus.DeploymentPos) uint32

func VersionBitsStateSinceHeight

func VersionBitsStateSinceHeight(indexPrev *blockindex.BlockIndex, params *model.BitcoinParams, pos consensus.DeploymentPos, vbc *VersionBitsCache) int

Types

type AbstractThresholdConditionChecker

type AbstractThresholdConditionChecker interface {
	Condition(index *blockindex.BlockIndex, params *model.BitcoinParams) bool
	BeginTime(params *model.BitcoinParams) int64
	EndTime(params *model.BitcoinParams) int64
	Period(params *model.BitcoinParams) int
	Threshold(params *model.BitcoinParams) int
}

type BIP9DeploymentInfo

type BIP9DeploymentInfo struct {
	Name     string
	GbtForce bool
}

type ThresholdConditionCache

type ThresholdConditionCache map[*blockindex.BlockIndex]ThresholdState

func NewWarnBitsCache

func NewWarnBitsCache(bitNum int) []ThresholdConditionCache

type ThresholdState

type ThresholdState int
const (
	ThresholdDefined ThresholdState = iota
	ThresholdStarted
	ThresholdLockedIn
	ThresholdActive
	ThresholdFailed
)

type VersionBitsCache

type VersionBitsCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var VBCache *VersionBitsCache // todo waring: there is a global variable(used as cache)

func NewVersionBitsCache

func NewVersionBitsCache() *VersionBitsCache

func (*VersionBitsCache) Clear

func (vbc *VersionBitsCache) Clear()

type VersionBitsConditionChecker

type VersionBitsConditionChecker struct {
	// contains filtered or unexported fields
}

func (*VersionBitsConditionChecker) BeginTime

func (vc *VersionBitsConditionChecker) BeginTime(params *model.BitcoinParams) int64

func (*VersionBitsConditionChecker) Condition

func (*VersionBitsConditionChecker) EndTime

func (*VersionBitsConditionChecker) Mask

func (*VersionBitsConditionChecker) Period

func (vc *VersionBitsConditionChecker) Period(params *model.BitcoinParams) int

func (*VersionBitsConditionChecker) Threshold

func (vc *VersionBitsConditionChecker) Threshold(params *model.BitcoinParams) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL