Versions in this module Expand all Collapse all v1 v1.0.2 Mar 23, 2022 v1.0.1 Mar 17, 2022 Changes in this version + const CheckpointConfirmations + const MaxCoinbaseScriptLen + const MaxSigOpsPerBlock + const MaxTimeOffsetSeconds + const MinCoinbaseScriptLen + const ViewpointPrevInvalidRegular + const ViewpointPrevInvalidStake + const ViewpointPrevValidInitial + const ViewpointPrevValidRegular + const ViewpointPrevValidStake + func BigToCompact(n *big.Int) uint32 + func BlockOneCoinbasePaysTokens(tx *hcutil.Tx, params *chaincfg.Params) error + func BuildMerkleTreeStore(transactions []*hcutil.Tx) []*chainhash.Hash + func CalcBlockTaxSubsidy(subsidyCache *SubsidyCache, height int64, voters uint16, ...) int64 + func CalcBlockWorkSubsidy(subsidyCache *SubsidyCache, height int64, voters uint16, ...) int64 + func CalcStakeVoteSubsidy(subsidyCache *SubsidyCache, height int64, params *chaincfg.Params) int64 + func CalcWork(bits uint32) *big.Int + func CalculateAddedSubsidy(block, parent *hcutil.Block) int64 + func CheckBlockSanity(block *hcutil.Block, timeSource MedianTimeSource, chainParams *chaincfg.Params) error + func CheckExtraData(extraData uint32) bool + func CheckExtraDataBuf(ExtraDataBuf []byte) bool + func CheckProofOfStake(block *hcutil.Block, posLimit int64) error + func CheckProofOfWork(block *hcutil.Block, powLimit *big.Int) error + func CheckTransactionInputs(subsidyCache *SubsidyCache, tx *hcutil.Tx, txHeight int64, ...) (int64, error) + func CheckTransactionSanity(tx *wire.MsgTx, params *chaincfg.Params) error + func CheckWorklessBlockSanity(block *hcutil.Block, timeSource MedianTimeSource, chainParams *chaincfg.Params) error + func CoinbasePaysTax(subsidyCache *SubsidyCache, tx *hcutil.Tx, height uint32, voters uint16, ...) error + func CompactToBig(compact uint32) *big.Int + func ConvertUtxosToMinimalOutputs(entry *UtxoEntry) []*stake.MinimalOutput + func CountP2SHSigOps(tx *hcutil.Tx, isCoinBaseTx bool, isStakeBaseTx bool, utxoView *UtxoViewpoint) (int, error) + func CountSigOps(tx *hcutil.Tx, isCoinBaseTx bool, isSSGen bool) int + func DBFetchBlockByHeight(dbTx database.Tx, height int64) (*hcutil.Block, error) + func DBFetchHeaderByHeight(dbTx database.Tx, height int64) (*wire.BlockHeader, error) + func DBMainChainHasBlock(dbTx database.Tx, hash *chainhash.Hash) bool + func DisableLog() + func DumpBlockChain(db database.DB, height int64) (map[int64][]byte, error) + func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash + func HashToBig(hash *chainhash.Hash) *big.Int + func IsCoinBase(tx *hcutil.Tx) bool + func IsCoinBaseTx(msgTx *wire.MsgTx) bool + func IsFinalizedTransaction(tx *hcutil.Tx, blockHeight int64, blockTime time.Time) bool + func IsFinalzedTransaction(tx *hcutil.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 btclog.Logger) + func ValidateTransactionScripts(tx *hcutil.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + type AssertError string + func (e AssertError) Error() string + type BehaviorFlags uint32 + const BFDryRun + const BFFastAdd + const BFNoPoWCheck + const BFNone + type BestState struct + Bits uint32 + BlockSize uint64 + Hash *chainhash.Hash + Height int64 + MedianTime time.Time + NumTxns uint64 + TotalSubsidy int64 + TotalTxns uint64 + type BlockAcceptedNtfnsData struct + Block *hcutil.Block + OnMainChain bool + type BlockChain struct + func New(config *Config) (*BlockChain, error) + func (b *BlockChain) BestPrevHash() chainhash.Hash + func (b *BlockChain) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *chainhash.Hash) (*hcutil.Block, error) + func (b *BlockChain) BlockByHeight(blockHeight int64) (*hcutil.Block, error) + func (b *BlockChain) BlockHashByHeight(blockHeight 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 *hcutil.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) ChainWork(hash *chainhash.Hash) (*big.Int, error) + func (b *BlockChain) CheckBlockStakeSanity(stakeValidationHeight int64, node *blockNode, block *hcutil.Block, ...) error + func (b *BlockChain) CheckConnectBlock(block *hcutil.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) CheckMainnetStakeVersion(header *wire.BlockHeader, prevNode *blockNode) error + func (b *BlockChain) CheckMissedTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) CheckTestnetStakeVersion(header *wire.BlockHeader, prevNode *blockNode) error + 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) FetchBlockByHash(hash *chainhash.Hash) (*hcutil.Block, error) + func (b *BlockChain) FetchSubsidyCache() *SubsidyCache + func (b *BlockChain) FetchUtxoEntry(txHash *chainhash.Hash) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *hcutil.Tx, treeValid bool) (*UtxoViewpoint, error) + func (b *BlockChain) ForceHeadReorganization(formerBest chainhash.Hash, newBest chainhash.Hash) error + func (b *BlockChain) GetGeneration(hash chainhash.Hash) ([]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) GetTopBlock() (*hcutil.Block, 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) HeaderByHeight(height int64) (*wire.BlockHeader, error) + func (b *BlockChain) HeightRange(startHeight, endHeight int64) ([]chainhash.Hash, error) + func (b *BlockChain) IsCheckpointCandidate(block *hcutil.Block) (bool, error) + func (b *BlockChain) IsCurrent() bool + func (b *BlockChain) IsKnownOrphan(hash *chainhash.Hash) bool + func (b *BlockChain) LatestBlockLocator() (BlockLocator, error) + func (b *BlockChain) LatestCheckpoint() *chaincfg.Checkpoint + func (b *BlockChain) LiveTickets() ([]chainhash.Hash, error) + func (b *BlockChain) LotteryDataForBlock(hash *chainhash.Hash) ([]chainhash.Hash, int, [6]byte, error) + func (b *BlockChain) MainChainHasBlock(hash *chainhash.Hash) (bool, error) + 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) ProcessBlock(block *hcutil.Block, flags BehaviorFlags) (bool, bool, error) + func (b *BlockChain) ThresholdState(hash *chainhash.Hash, version uint32, deploymentID string) (ThresholdStateTuple, error) + func (b *BlockChain) TicketPoolValue() (hcutil.Amount, error) + func (b *BlockChain) TicketsWithAddress(address hcutil.Address) ([]chainhash.Hash, error) + func (b *BlockChain) TipGeneration() ([]chainhash.Hash, error) + func (b *BlockChain) TotalSubsidy() int64 + type BlockLocator []*chainhash.Hash + type Config struct + ChainParams *chaincfg.Params + DB database.DB + IndexManager IndexManager + Notifications NotificationCallback + SigCache *txscript.SigCache + TimeSource MedianTimeSource + type DeploymentError string + func (e DeploymentError) Error() string + type ErrorCode int + const ErrBadBlockHeight + const ErrBadCheckpoint + const ErrBadCoinbaseAmountIn + const ErrBadCoinbaseFraudProof + const ErrBadCoinbaseOutpoint + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadFees + const ErrBadMerkleRoot + 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 ErrCheckExtraData + const ErrCheckpointTimeTooOld + const ErrCoinbaseHeight + const ErrDifficultyTooLow + const ErrDiscordantTxTree + const ErrDoubleSpend + 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 ErrIncongruentVotebit + const ErrInvalidEarlyStakeTx + const ErrInvalidEarlyVoteBits + const ErrInvalidFinalState + const ErrInvalidSSGenInput + const ErrInvalidSSRtx + const ErrInvalidSSRtxInput + const ErrInvalidTime + const ErrMissingParent + const ErrMissingTx + const ErrMultipleCoinbases + const ErrNoStakeTx + const ErrNoTax + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrNonstandardStakeTx + const ErrNotEnoughStake + const ErrNotEnoughVotes + const ErrOverwriteTx + const ErrPoolSize + const ErrRegTxInStakeTree + const ErrRegTxSpendStakeOut + const ErrRevocationsMismatch + const ErrSSGenPayeeNum + const ErrSSGenPayeeOuts + const ErrSSGenSubsidy + const ErrSSRtxPayees + const ErrSSRtxPayeesMismatch + const ErrSStxCommitment + const ErrSStxInImmature + const ErrSStxInScrType + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrStakeBelowMinimum + const ErrStakeFees + const ErrStakeTxInRegularTree + 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 ErrUnparseableSSGen + 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, *hcutil.Block, *hcutil.Block, *UtxoViewpoint) error + DisconnectBlock func(database.Tx, *hcutil.Block, *hcutil.Block, *UtxoViewpoint) error + Init func(*BlockChain) error + type MedianTimeSource interface + AddTimeSample func(id string, timeVal time.Time) + AdjustedTime func() time.Time + Offset func() time.Duration + func NewMedianTime() MedianTimeSource + type Notification struct + Data interface{} + Type NotificationType + type NotificationCallback func(*Notification) + type NotificationType int + const NTBlockAccepted + const NTBlockConnected + const NTBlockDisconnected + const NTNewTickets + 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 []VoteVersionTuple + type StakeViewpoint int8 + type SubsidyCache struct + func NewSubsidyCache(height int64, params *chaincfg.Params) *SubsidyCache + func (s *SubsidyCache) CalcBlockSubsidy(height int64) int64 + 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 *hcutil.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) SetBestHash(hash *chainhash.Hash) + func (view *UtxoViewpoint) SetStakeViewpoint(sv StakeViewpoint) + func (view *UtxoViewpoint) StakeViewpoint() StakeViewpoint + 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 + type VoteVersionTuple struct + Bits uint16 + Version uint32