Versions in this module Expand all Collapse all v3 v3.1.0 May 12, 2022 Changes in this version + const CheckpointConfirmations + const HeaderCmtFilterIndex + const MaxCoinbaseScriptLen + const MaxSigOpsPerBlock + const MaxTimeOffsetSeconds + const MinCoinbaseScriptLen + func CalcCommitmentRootV1(filterHash chainhash.Hash) chainhash.Hash + func CheckBlockSanity(block *dcrutil.Block, timeSource MedianTimeSource, ...) error + func CheckProofOfStake(block *dcrutil.Block, posLimit int64) error + func CheckTransactionInputs(subsidyCache *standalone.SubsidyCache, tx *dcrutil.Tx, txHeight int64, ...) (int64, error) + func CheckTransactionSanity(tx *wire.MsgTx, params *chaincfg.Params) error + func ConvertUtxosToMinimalOutputs(entry *UtxoEntry) []*stake.MinimalOutput + func CountP2SHSigOps(tx *dcrutil.Tx, isCoinBaseTx bool, isStakeBaseTx bool, view *UtxoViewpoint) (int, error) + func CountSigOps(tx *dcrutil.Tx, isCoinBaseTx bool, isSSGen bool) int + func IsExpired(tx *dcrutil.Tx, blockHeight int64) bool + func IsExpiredTx(tx *wire.MsgTx, blockHeight int64) bool + func IsFinalizedTransaction(tx *dcrutil.Tx, blockHeight int64, blockTime time.Time) bool + func LockTimeToSequence(isSeconds bool, lockTime uint32) (uint32, error) + func SequenceLockActive(lock *SequenceLock, blockHeight int64, medianTime time.Time) bool + func UseLogger(logger slog.Logger) + func ValidateTransactionScripts(tx *dcrutil.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + type AssertError string + func (e AssertError) Error() string + type BehaviorFlags uint32 + const BFFastAdd + const BFNoPoWCheck + const BFNone + type BestState struct + Bits uint32 + BlockSize uint64 + Hash chainhash.Hash + Height int64 + MedianTime time.Time + MissedTickets []chainhash.Hash + NextFinalState [6]byte + NextPoolSize uint32 + NextStakeDiff int64 + NextWinningTickets []chainhash.Hash + NumTxns uint64 + PrevHash chainhash.Hash + TotalSubsidy int64 + TotalTxns uint64 + type BlockAcceptedNtfnsData struct + BestHeight int64 + Block *dcrutil.Block + ForkLen int64 + type BlockChain struct + func New(config *Config) (*BlockChain, error) + func (b *BlockChain) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *chainhash.Hash) (*dcrutil.Block, error) + func (b *BlockChain) BlockByHeight(height int64) (*dcrutil.Block, error) + func (b *BlockChain) BlockHashByHeight(height int64) (*chainhash.Hash, error) + func (b *BlockChain) BlockHeightByHash(hash *chainhash.Hash) (int64, error) + func (b *BlockChain) BlockLocatorFromHash(hash *chainhash.Hash) BlockLocator + func (b *BlockChain) CalcNextRequiredDiffFromNode(hash *chainhash.Hash, timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcNextRequiredDifficulty(timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcNextRequiredStakeDifficulty() (int64, error) + func (b *BlockChain) CalcSequenceLock(tx *dcrutil.Tx, view *UtxoViewpoint) (*SequenceLock, error) + func (b *BlockChain) CalcStakeVersionByHash(hash *chainhash.Hash) (uint32, error) + func (b *BlockChain) CalcWantHeight(interval, height int64) int64 + func (b *BlockChain) ChainTips() []ChainTipInfo + func (b *BlockChain) ChainWork(hash *chainhash.Hash) (*big.Int, error) + func (b *BlockChain) CheckConnectBlockTemplate(block *dcrutil.Block) error + func (b *BlockChain) CheckExpiredTicket(hash chainhash.Hash) bool + func (b *BlockChain) CheckExpiredTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) CheckLiveTicket(hash chainhash.Hash) bool + func (b *BlockChain) CheckLiveTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) CheckMissedTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) Checkpoints() []chaincfg.Checkpoint + func (b *BlockChain) CountVoteVersion(version uint32) (uint32, error) + func (b *BlockChain) DisableCheckpoints(disable bool) + func (b *BlockChain) DisableVerify(disable bool) + func (b *BlockChain) EstimateNextStakeDifficulty(newTickets int64, useMaxTickets bool) (int64, error) + func (b *BlockChain) FetchUtxoEntry(txHash *chainhash.Hash) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *dcrutil.Tx, includePrevRegularTxns bool) (*UtxoViewpoint, error) + func (b *BlockChain) FetchUtxoViewParentTemplate(block *wire.MsgBlock) (*UtxoViewpoint, error) + func (b *BlockChain) FilterByBlockHash(hash *chainhash.Hash) (*gcs.FilterV2, error) + func (b *BlockChain) ForceHeadReorganization(formerBest chainhash.Hash, newBest chainhash.Hash) error + func (b *BlockChain) GetOrphanRoot(hash *chainhash.Hash) *chainhash.Hash + func (b *BlockChain) GetStakeVersions(hash *chainhash.Hash, count int32) ([]StakeVersions, error) + func (b *BlockChain) GetVoteCounts(version uint32, deploymentID string) (VoteCounts, error) + func (b *BlockChain) GetVoteInfo(hash *chainhash.Hash, version uint32) (*VoteInfo, error) + func (b *BlockChain) HaveBlock(hash *chainhash.Hash) (bool, error) + func (b *BlockChain) HeaderByHash(hash *chainhash.Hash) (wire.BlockHeader, error) + func (b *BlockChain) HeaderByHeight(height int64) (wire.BlockHeader, error) + func (b *BlockChain) HeightRange(startHeight, endHeight int64) ([]chainhash.Hash, error) + func (b *BlockChain) IsCheckpointCandidate(block *dcrutil.Block) (bool, error) + func (b *BlockChain) IsCurrent() bool + func (b *BlockChain) IsFixSeqLocksAgendaActive() (bool, error) + func (b *BlockChain) IsHeaderCommitmentsAgendaActive(prevHash *chainhash.Hash) (bool, error) + func (b *BlockChain) IsKnownOrphan(hash *chainhash.Hash) bool + func (b *BlockChain) IsLNFeaturesAgendaActive() (bool, error) + func (b *BlockChain) LatestBlockLocator() (BlockLocator, error) + func (b *BlockChain) LatestCheckpoint() *chaincfg.Checkpoint + func (b *BlockChain) LiveTickets() ([]chainhash.Hash, error) + func (b *BlockChain) LocateBlocks(locator BlockLocator, hashStop *chainhash.Hash, maxHashes uint32) []chainhash.Hash + func (b *BlockChain) LocateHeaders(locator BlockLocator, hashStop *chainhash.Hash) []wire.BlockHeader + func (b *BlockChain) LotteryDataForBlock(hash *chainhash.Hash) ([]chainhash.Hash, int, [6]byte, error) + func (b *BlockChain) MainChainHasBlock(hash *chainhash.Hash) bool + func (b *BlockChain) MaxBlockSize() (int64, error) + func (b *BlockChain) MissedTickets() ([]chainhash.Hash, error) + func (b *BlockChain) NextLotteryData() ([]chainhash.Hash, int, [6]byte, error) + func (b *BlockChain) NextThresholdState(hash *chainhash.Hash, version uint32, deploymentID string) (ThresholdStateTuple, error) + func (b *BlockChain) ProcessBlock(block *dcrutil.Block, flags BehaviorFlags) (int64, bool, error) + func (b *BlockChain) StateLastChangedHeight(hash *chainhash.Hash, version uint32, deploymentID string) (int64, error) + func (b *BlockChain) TicketPoolValue() (dcrutil.Amount, error) + func (b *BlockChain) TicketsWithAddress(address dcrutil.Address) ([]chainhash.Hash, error) + func (b *BlockChain) TipGeneration() ([]chainhash.Hash, error) + type BlockLocator []*chainhash.Hash + type ChainTipInfo struct + BranchLen int64 + Hash chainhash.Hash + Height int64 + Status string + type Config struct + ChainParams *chaincfg.Params + DB database.DB + IndexManager IndexManager + Interrupt <-chan struct{} + Notifications NotificationCallback + SigCache *txscript.SigCache + SubsidyCache *standalone.SubsidyCache + TimeSource MedianTimeSource + type DeploymentError string + func (e DeploymentError) Error() string + type DuplicateDeploymentError string + func (e DuplicateDeploymentError) Error() string + type ErrorCode int + const ErrBadBlockHeight + const ErrBadCheckpoint + const ErrBadCoinbaseAmountIn + const ErrBadCoinbaseFraudProof + const ErrBadCoinbaseOutpoint + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadCommitmentRoot + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadNumPayees + const ErrBadPayeeScriptType + const ErrBadPayeeScriptVersion + const ErrBadPayeeValue + const ErrBadStakeVersion + const ErrBadStakebaseAmountIn + const ErrBadStakebaseScrVal + const ErrBadStakebaseScriptLen + const ErrBadStakebaseValue + const ErrBadTxInput + const ErrBadTxOutValue + const ErrBlockOneInputs + const ErrBlockOneOutputs + const ErrBlockOneTx + const ErrBlockTooBig + const ErrBlockVersionTooOld + const ErrCheckpointTimeTooOld + const ErrCoinbaseHeight + const ErrDifficultyTooLow + const ErrDiscordantTxTree + const ErrDuplicateBlock + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrExpiredTx + const ErrExpiryTxSpentEarly + const ErrFirstTxNotCoinbase + const ErrForceReorgMissingChild + const ErrForceReorgWrongChain + const ErrForkTooOld + const ErrFraudAmountIn + const ErrFraudBlockHeight + const ErrFraudBlockIndex + const ErrFreshStakeMismatch + const ErrHighHash + const ErrImmatureSpend + const ErrImmatureTicketSpend + const ErrIncongruentVotebit + const ErrInvalidAncestorBlock + const ErrInvalidEarlyFinalState + const ErrInvalidEarlyStakeTx + const ErrInvalidEarlyVoteBits + const ErrInvalidFinalState + const ErrInvalidRevokeInput + const ErrInvalidSSRtx + const ErrInvalidTemplateParent + const ErrInvalidTime + const ErrInvalidVoteInput + const ErrKnownInvalidBlock + const ErrMismatchedPayeeHash + const ErrMissingParent + const ErrMissingTxOut + const ErrMultipleCoinbases + const ErrNoStakeTx + const ErrNoTax + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrNonstandardStakeTx + const ErrNotEnoughStake + const ErrNotEnoughVotes + const ErrOverwriteTx + const ErrPoolSize + const ErrRegTxCreateStakeOut + const ErrRegTxInStakeTree + const ErrRevocationsMismatch + const ErrSSGenSubsidy + const ErrSSRtxPayees + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrStakeBelowMinimum + const ErrStakeFees + const ErrStakeTxInRegularTree + const ErrTicketCommitment + const ErrTicketInputScript + const ErrTicketUnavailable + const ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManyRevocations + const ErrTooManySStxs + const ErrTooManySigOps + const ErrTooManyTransactions + const ErrTooManyVotes + const ErrTxSStxOutSpend + const ErrTxTooBig + const ErrUnexpectedDifficulty + const ErrUnfinalizedTx + const ErrVotesMismatch + const ErrVotesOnWrongBlock + const ErrWrongBlockSize + const ErrZeroValueOutputSpend + func (e ErrorCode) String() string + type HashError string + func (e HashError) Error() string + type IndexManager interface + ConnectBlock func(database.Tx, *dcrutil.Block, *dcrutil.Block, *UtxoViewpoint) error + DisconnectBlock func(database.Tx, *dcrutil.Block, *dcrutil.Block, *UtxoViewpoint) error + Init func(*BlockChain, <-chan struct{}) error + type MedianTimeSource interface + AddTimeSample func(id string, timeVal time.Time) + AdjustedTime func() time.Time + Offset func() time.Duration + func NewMedianTime() MedianTimeSource + type NoFilterError string + func (e NoFilterError) Error() string + type Notification struct + Data interface{} + Type NotificationType + type NotificationCallback func(*Notification) + type NotificationType int + const NTBlockAccepted + const NTBlockConnected + const NTBlockDisconnected + const NTChainReorgDone + const NTChainReorgStarted + const NTNewTickets + const NTNewTipBlockChecked + const NTReorganization + const NTSpentAndMissedTickets + func (n NotificationType) String() string + type ReorganizationNtfnsData struct + NewHash chainhash.Hash + NewHeight int64 + OldHash chainhash.Hash + OldHeight int64 + type RuleError struct + Description string + ErrorCode ErrorCode + func (e RuleError) Error() string + type SequenceLock struct + MinHeight int64 + MinTime int64 + type StakeVersions struct + BlockVersion int32 + Hash chainhash.Hash + Height int64 + StakeVersion uint32 + Votes []stake.VoteVersionTuple + type ThresholdState byte + const ThresholdActive + const ThresholdDefined + const ThresholdFailed + const ThresholdInvalid + const ThresholdLockedIn + const ThresholdStarted + func (t ThresholdState) String() string + type ThresholdStateTuple struct + Choice uint32 + State ThresholdState + func (t ThresholdStateTuple) String() string + type TicketNotificationsData struct + Hash chainhash.Hash + Height int64 + StakeDifficulty int64 + TicketsMissed []chainhash.Hash + TicketsNew []chainhash.Hash + TicketsSpent []chainhash.Hash + type UtxoEntry struct + func (entry *UtxoEntry) AmountByIndex(outputIndex uint32) int64 + func (entry *UtxoEntry) BlockHeight() int64 + func (entry *UtxoEntry) BlockIndex() uint32 + func (entry *UtxoEntry) Clone() *UtxoEntry + func (entry *UtxoEntry) HasExpiry() bool + func (entry *UtxoEntry) IsCoinBase() bool + func (entry *UtxoEntry) IsFullySpent() bool + func (entry *UtxoEntry) IsOutputSpent(outputIndex uint32) bool + func (entry *UtxoEntry) PkScriptByIndex(outputIndex uint32) []byte + func (entry *UtxoEntry) ScriptVersionByIndex(outputIndex uint32) uint16 + func (entry *UtxoEntry) SpendOutput(outputIndex uint32) + func (entry *UtxoEntry) TransactionType() stake.TxType + func (entry *UtxoEntry) TxVersion() uint16 + type UtxoViewpoint struct + func NewUtxoViewpoint() *UtxoViewpoint + func (view *UtxoViewpoint) AddTxOuts(tx *dcrutil.Tx, blockHeight int64, blockIndex uint32) + func (view *UtxoViewpoint) BestHash() *chainhash.Hash + func (view *UtxoViewpoint) Entries() map[chainhash.Hash]*UtxoEntry + func (view *UtxoViewpoint) LookupEntry(txHash *chainhash.Hash) *UtxoEntry + func (view *UtxoViewpoint) PrevScript(prevOut *wire.OutPoint) (uint16, []byte, bool) + func (view *UtxoViewpoint) SetBestHash(hash *chainhash.Hash) + type VoteCounts struct + Total uint32 + TotalAbstain uint32 + VoteChoices []uint32 + type VoteInfo struct + AgendaStatus []ThresholdStateTuple + Agendas []chaincfg.ConsensusDeployment + type VoteVersionError uint32 + func (e VoteVersionError) Error() string Other modules containing this package github.com/Decred-Next/dcrnd github.com/Decred-Next/dcrnd/blockchain/v8