Versions in this module Expand all Collapse all v0 v0.0.3 Feb 7, 2021 Changes in this version + const CheckpointConfirmations + const CoinbaseOutput_data + const CoinbaseOutput_tax + const MaxCoinbaseScriptLen + const MaxOrphanBlocks + const MaxOrphanStallDuration + const MaxOrphanTimeOffsetSeconds + const MaxSigOpsPerBlock + const MaxTimeOffsetSeconds + const MinCoinbaseScriptLen + const SpentTxOutTxInIndexSize + const SpentTxOutTxIndexSize + func CalcBlockTaxSubsidy(subsidyCache *SubsidyCache, blocks int64, params *params.Params) uint64 + func CalcBlockWorkSubsidy(subsidyCache *SubsidyCache, blocks int64, params *params.Params) uint64 + func CheckTransactionSanity(tx *types.Transaction, params *params.Params) error + func CountP2SHSigOps(tx *types.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint) (int, error) + func CountSigOps(tx *types.Tx) int + func DBFetchBlockByOrder(dbTx database.Tx, order uint64) (*types.SerializedBlock, error) + func ExtractCoinbaseHeight(coinbaseTx *types.Transaction) (uint64, error) + func GetMaxLayerFromList(list []*blockNode) uint + func IsExpired(tx *types.Tx, blockHeight uint64) bool + func IsExpiredTx(tx *types.Transaction, blockHeight uint64) bool + func IsFinalizedTransaction(tx *types.Tx, blockHeight uint64, 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 l.Logger) + func ValidateTransactionScripts(tx *types.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + type AssertError string + func (e AssertError) Error() string + type BehaviorFlags uint32 + const BFFastAdd + const BFNoPoWCheck + const BFNone + const BFP2PAdd + type BestState struct + Bits uint32 + BlockSize uint64 + GraphState *blockdag.GraphState + Hash hash.Hash + MedianTime time.Time + NumTxns uint64 + TotalSubsidy uint64 + TotalTxns uint64 + type BlockAcceptedNotifyData struct + Block *types.SerializedBlock + Flags BehaviorFlags + ForkLen int64 + type BlockChain struct + BlockVersion uint32 + CacheInvalidTx bool + func New(config *Config) (*BlockChain, error) + func (b *BlockChain) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *hash.Hash) (*types.SerializedBlock, error) + func (b *BlockChain) BlockByOrder(blockOrder uint64) (*types.SerializedBlock, error) + func (b *BlockChain) BlockDAG() *blockdag.BlockDAG + func (b *BlockChain) BlockHashByOrder(blockOrder uint64) (*hash.Hash, error) + func (b *BlockChain) BlockIndex() *blockIndex + func (b *BlockChain) BlockLocatorFromHash(hash *hash.Hash) BlockLocator + func (b *BlockChain) BlockOrderByHash(hash *hash.Hash) (uint64, error) + func (b *BlockChain) CalcNextRequiredDiffFromNode(hash *hash.Hash, timestamp time.Time, powType pow.PowType) (uint32, error) + func (b *BlockChain) CalcNextRequiredDifficulty(timestamp time.Time, powType pow.PowType) (uint32, error) + func (b *BlockChain) CalcSequenceLock(tx *types.Tx, view *UtxoViewpoint) (*SequenceLock, error) + func (b *BlockChain) CalcWeight(blocks int64, blockhash *hash.Hash, state byte) int64 + func (b *BlockChain) CalculateDAGDuplicateTxs(block *types.SerializedBlock) + func (b *BlockChain) CalculateFees(block *types.SerializedBlock) int64 + func (b *BlockChain) ChainLock() + func (b *BlockChain) ChainRLock() + func (b *BlockChain) ChainRUnlock() + func (b *BlockChain) ChainUnlock() + func (b *BlockChain) CheckCacheInvalidTxConfig() error + func (b *BlockChain) CheckConnectBlockTemplate(block *types.SerializedBlock) error + func (b *BlockChain) CheckTransactionInputs(tx *types.Tx, utxoView *UtxoViewpoint) (int64, error) + func (b *BlockChain) Checkpoints() []params.Checkpoint + func (b *BlockChain) DisableCheckpoints(disable bool) + func (b *BlockChain) DumpBlockChain(dumpFile string, params *params.Params, order uint64) error + func (b *BlockChain) FastAcceptBlock(block *types.SerializedBlock) error + func (b *BlockChain) FetchBlockByHash(hash *hash.Hash) (*types.SerializedBlock, error) + func (b *BlockChain) FetchSpendJournal(targetBlock *types.SerializedBlock) ([]SpentTxOut, error) + func (b *BlockChain) FetchSubsidyCache() *SubsidyCache + func (b *BlockChain) FetchUtxoEntry(outpoint types.TxOutPoint) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *types.Tx) (*UtxoViewpoint, error) + func (b *BlockChain) GetCurrentPowDiff(curNode blockNode, powType pow.PowType) *big.Int + func (b *BlockChain) GetFees(h *hash.Hash) int64 + func (b *BlockChain) GetMiningTips() []*hash.Hash + func (b *BlockChain) GetOrphan(hash *hash.Hash) *types.SerializedBlock + func (b *BlockChain) GetOrphansParents() []*hash.Hash + func (b *BlockChain) GetOrphansTotal() int + func (b *BlockChain) GetRecentOrphanParents(h *hash.Hash) []*hash.Hash + func (b *BlockChain) GetRecentOrphansParents() []*hash.Hash + func (b *BlockChain) HasCheckpoints() bool + func (b *BlockChain) HaveBlock(hash *hash.Hash) (bool, error) + func (b *BlockChain) HeaderByHash(hash *hash.Hash) (types.BlockHeader, error) + func (b *BlockChain) IsCheckpointCandidate(preBlock, block blockdag.IBlock) (bool, error) + func (b *BlockChain) IsCurrent() bool + func (b *BlockChain) IsDuplicateTx(txid *hash.Hash, blockHash *hash.Hash) bool + func (b *BlockChain) IsOrphan(hash *hash.Hash) bool + func (b *BlockChain) IsOrphanOK(serializedHeight uint64) bool + func (b *BlockChain) IsUnconnectedOrphan(hash *hash.Hash) bool + func (b *BlockChain) LatestBlockLocator() (BlockLocator, error) + func (b *BlockChain) LatestCheckpoint() *params.Checkpoint + func (b *BlockChain) MainChainHasBlock(hash *hash.Hash) bool + func (b *BlockChain) ProcessBlock(block *types.SerializedBlock, flags BehaviorFlags) (bool, error) + func (b *BlockChain) RefreshOrphans() error + func (b *BlockChain) RemoveOrphanBlock(orphan *orphanBlock) + func (b *BlockChain) TimeSource() MedianTimeSource + func (b *BlockChain) TipGeneration() ([]hash.Hash, error) + func (bc *BlockChain) IsInvalidOut(entry *UtxoEntry) bool + type BlockLocator []*hash.Hash + type BlockNodeList []*blockNode + func (bn BlockNodeList) Len() int + func (bn BlockNodeList) Less(i, j int) bool + func (bn BlockNodeList) Swap(i, j int) + type BlockStatus byte + func (status BlockStatus) HaveData() bool + func (status BlockStatus) KnownInvalid() bool + func (status BlockStatus) KnownValid() bool + type Config struct + BlockVersion uint32 + CacheInvalidTx bool + ChainParams *params.Params + DAGType string + DB database.DB + IndexManager IndexManager + Interrupt <-chan struct{} + 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 ErrBadCuckooNonces + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadParentsMerkleRoot + const ErrBlockOneInputs + const ErrBlockOneOutputs + const ErrBlockOneTx + const ErrBlockTooBig + const ErrBlockVersionTooOld + const ErrCheckpointTimeTooOld + const ErrCoinbaseHeight + const ErrDifficultyTooLow + const ErrDuplicateBlock + const ErrDuplicateParent + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrExpiredTx + const ErrExpiryTxSpentEarly + const ErrFirstTxNotCoinbase + const ErrForceReorgMissingChild + const ErrForceReorgWrongChain + const ErrForkTooOld + const ErrFraudAmountIn + const ErrFraudBlockHeight + const ErrFraudBlockIndex + const ErrHighHash + const ErrImmatureSpend + const ErrInValidPowType + const ErrInvalidAncestorBlock + const ErrInvalidEarlyFinalState + const ErrInvalidFinalState + const ErrInvalidPow + const ErrInvalidTemplateParent + const ErrInvalidTime + const ErrInvalidTxInput + const ErrInvalidTxOutValue + const ErrIrregTxInRegularTree + const ErrMissingCoinbaseHeight + const ErrMissingParent + const ErrMissingTxOut + const ErrMultipleCoinbases + const ErrNoBlueCoinbase + const ErrNoParents + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrNoViewpoint + const ErrOverwriteTx + const ErrParentsBlockUnknown + const ErrPoolSize + const ErrPrevBlockNotBest + const ErrRevocationsMismatch + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManyRevocations + const ErrTooManySigOps + const ErrTooManyTransactions + const ErrTxTooBig + const ErrUnexpectedDifficulty + const ErrUnfinalizedTx + const ErrWrongBlockSize + const ErrZeroValueOutputSpend + func (e ErrorCode) String() string + type HashError string + func (e HashError) Error() string + type IndexManager interface + ConnectBlock func(tx database.Tx, block *types.SerializedBlock, stxos []SpentTxOut) error + DisconnectBlock func(tx database.Tx, block *types.SerializedBlock, stxos []SpentTxOut) error + Init func(*BlockChain, <-chan struct{}) error + IsDuplicateTx func(tx database.Tx, txid *hash.Hash, blockHash *hash.Hash) bool + 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 BlockAccepted + const BlockConnected + const BlockDisconnected + const Reorganization + func (n NotificationType) String() string + type ReorganizationNotifyData struct + NewHash hash.Hash + NewHeight uint64 + OldHash hash.Hash + OldHeight uint64 + type RuleError struct + Description string + ErrorCode ErrorCode + func (e RuleError) Error() string + type SequenceLock struct + BlockHeight int64 + Time int64 + type SpentTxOut struct + Amount uint64 + BlockHash hash.Hash + IsCoinBase bool + OriAmount uint64 + PkScript []byte + TxInIndex uint32 + TxIndex uint32 + func GetStxo(txIndex uint32, txInIndex uint32, stxos []SpentTxOut) *SpentTxOut + type SubsidyCache struct + func NewSubsidyCache(blocks int64, params *params.Params) *SubsidyCache + func (s *SubsidyCache) CalcBlockSubsidy(blocks int64) int64 + type UtxoEntry struct + func DeserializeUtxoEntry(serialized []byte) (*UtxoEntry, error) + func (entry *UtxoEntry) Amount() uint64 + func (entry *UtxoEntry) BlockHash() *hash.Hash + func (entry *UtxoEntry) Clone() *UtxoEntry + func (entry *UtxoEntry) IsCoinBase() bool + func (entry *UtxoEntry) IsSpent() bool + func (entry *UtxoEntry) PkScript() []byte + func (entry *UtxoEntry) Spend() + type UtxoViewpoint struct + func NewUtxoViewpoint() *UtxoViewpoint + func (view *UtxoViewpoint) AddTxOut(tx *types.Tx, txOutIdx uint32, blockHash *hash.Hash) + func (view *UtxoViewpoint) AddTxOuts(tx *types.Tx, blockHash *hash.Hash) + func (view *UtxoViewpoint) Clean() + func (view *UtxoViewpoint) Entries() map[types.TxOutPoint]*UtxoEntry + func (view *UtxoViewpoint) FetchInputUtxos(db database.DB, block *types.SerializedBlock, bc *BlockChain) error + func (view *UtxoViewpoint) FilterInvalidOut(bc *BlockChain) + func (view *UtxoViewpoint) LookupEntry(outpoint types.TxOutPoint) *UtxoEntry + func (view *UtxoViewpoint) RemoveEntry(outpoint types.TxOutPoint) + func (view *UtxoViewpoint) SetViewpoints(views []*hash.Hash) + func (view *UtxoViewpoint) Viewpoints() []*hash.Hash