consensus

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: 34

Documentation

Index

Constants

View Source
const (
	//OneMegaByte  1MB
	OneMegaByte = 1000000

	//MaxTxSize  The maximum allowed size for a transaction, in bytes
	MaxTxSize = OneMegaByte

	//LegacyMaxBlockSize  The maximum allowed size for a block, before the UAHF
	LegacyMaxBlockSize = OneMegaByte

	//DefaultMaxBlockSize  Default setting for maximum allowed size for a block, in bytes
	DefaultMaxBlockSize = 32 * OneMegaByte
	/*MaxBlockSigopsPerMb  The maximum allowed number of signature check operations per MB in a block
	* (network rule) */
	MaxBlockSigopsPerMb = 20000

	/*MaxTxSigOpsCount allowed number of signature check operations per transaction. */
	MaxTxSigOpsCount = 20000

	// CoinbaseMaturity means Coinbase transaction outputs can only be spent after this number of new
	// blocks (network rule)
	CoinbaseMaturity = 100

	MinTxSize = 100
)
View Source
const (
	// LocktimeVerifySequence ,  Interpret sequence numbers as relative lock-time constraints.
	LocktimeVerifySequence = 1 << iota

	// LocktimeMedianTimePast , Use GetMedianTimePast() instead of nTime for end point timestamp.
	LocktimeMedianTimePast
)

Variables

This section is empty.

Functions

func GetMaxBlockSigOpsCount

func GetMaxBlockSigOpsCount(blockSize uint64) (uint64, error)

Types

type BIP9Deployment

type BIP9Deployment struct {
	/** Bit position to select the particular bit in nVersion. */
	Bit int
	/** Start MedianTime for version bits miner confirmation. Can be a date in
	 * the past */
	StartTime int64
	/** Timeout/expiry MedianTime for the deployment attempt. */
	Timeout int64
}

type DeploymentPos

type DeploymentPos int
const (
	DeploymentTestDummy DeploymentPos = iota
	// DeploymentCSV deployment of BIP68, BIP112, and BIP113.
	DeploymentCSV
	// MaxVersionBitsDeployments NOTE: Also add new deployments to VersionBitsDeploymentInfo in
	// versionbits.cpp
	MaxVersionBitsDeployments
)

type Param

type Param struct {
	GenesisHash            *util.Hash
	SubsidyHalvingInterval int
	// Block height and hash at which BIP34 becomes active
	BIP34Height int32
	BIP34Hash   util.Hash
	//  Block height at which BIP65 becomes active
	BIP65Height int32
	//  Block height at which BIP66 becomes active
	BIP66Height int32
	// Block height at which CSV (BIP68, BIP112 and BIP113) becomes active
	CSVHeight int32
	//  Block height at which UAHF kicks in
	UAHFHeight int32

	//  Activation time at which the cash HF kicks in.
	//CashHardForkActivationTime int64
	// Block height at which the new DAA becomes active
	DAAHeight int32

	// Unix time used for MTP activation of May 15 2018, hardfork
	MonolithActivationTime int64

	// Unix time used for MTP activation of Nov 15 2018, hardfork
	MagneticAnomalyActivationTime int64
	// Unix time used for MTP activation of 15 May 2019 12:00:00 UTC upgrade */
	GreatWallActivationTime int64

	// Minimum blocks including miner confirmation of the total of 2016 blocks
	// in a retargeting period, (nPowTargetTimespan / nPowTargetSpacing) which
	// is also used for BIP9 deployments.
	// Examples: 1916 for 95%, 1512 for testchains.
	RuleChangeActivationThreshold uint32

	MinerConfirmationWindow uint32

	Deployments [MaxVersionBitsDeployments]BIP9Deployment

	// Proof of work parameters
	PowLimit                     *big.Int
	FPowAllowMinDifficultyBlocks bool
	FPowNoRetargeting            bool
	TargetTimePerBlock           time.Duration
	TargetTimespan               time.Duration

	// The best chain should have at least this much work.
	MinimumChainWork util.Hash

	// By default assume that the signatures in ancestors of this block are valid.
	DefaultAssumeValid util.Hash
}

func (*Param) DifficultyAdjustmentInterval

func (pm *Param) DifficultyAdjustmentInterval() int64

Jump to

Keyboard shortcuts

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