Versions in this module Expand all Collapse all v0 v0.14.0 Mar 21, 2019 Changes in this version + const CheckpointConfirmations + const DifficultyAdjustmentWindow + const LegacyMaxBlockSize + const MaxBlockSigOpsPerMB + const MaxCoinbaseScriptLen + const MaxTimeOffsetSeconds + const MaxTransactionSigOps + const MaxTransactionSize + const MinCoinbaseScriptLen + const MinTransactionSize + func BigToCompact(n *big.Int) uint32 + func BuildMerkleTreeStore(transactions []*bchutil.Tx) []*chainhash.Hash + func CalcBlockSubsidy(height int32, chainParams *chaincfg.Params) int64 + func CalcWork(bits uint32) *big.Int + func CheckBlockSanity(block *bchutil.Block, powLimit *big.Int, timeSource MedianTimeSource, ...) error + func CheckProofOfWork(block *bchutil.Block, powLimit *big.Int) error + func CheckTransactionInputs(tx *bchutil.Tx, txHeight int32, utxoView *UtxoViewpoint, ...) (int64, error) + func CheckTransactionSanity(tx *bchutil.Tx, magneticAnomalyActive bool, scriptFlags txscript.ScriptFlags) error + func CompactToBig(compact uint32) *big.Int + func CountP2SHSigOps(tx *bchutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint, ...) (int, error) + func CountSigOps(tx *bchutil.Tx, scriptFlags txscript.ScriptFlags) int + func DeserializeOutpointKey(key []byte) *wire.OutPoint + func DisableLog() + func ExtractCoinbaseHeight(coinbaseTx *bchutil.Tx) (int32, error) + func GetSigOps(tx *bchutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint, ...) (int, error) + func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash + func HashToBig(hash *chainhash.Hash) *big.Int + func IsCoinBase(tx *bchutil.Tx) bool + func IsCoinBaseTx(msgTx *wire.MsgTx) bool + func IsFinalizedTransaction(tx *bchutil.Tx, blockHeight int32, blockTime time.Time) bool + func LockTimeToSequence(isSeconds bool, locktime uint32) uint32 + func MaxBlockSigOps(nBlockBytes uint32) int + func SequenceLockActive(sequenceLock *SequenceLock, blockHeight int32, medianTimePast time.Time) bool + func ShouldHaveSerializedBlockHeight(header *wire.BlockHeader) bool + func UseLogger(logger bchlog.Logger) + func ValidateTransactionScripts(tx *bchutil.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + type AssertError string + func (e AssertError) Error() string + type BehaviorFlags uint32 + const BFFastAdd + const BFMagneticAnomaly + const BFNoDupBlockCheck + const BFNoPoWCheck + const BFNone + func (behaviorFlags BehaviorFlags) HasFlag(flag BehaviorFlags) bool + type BestState struct + Bits uint32 + BlockSize uint64 + Hash chainhash.Hash + Height int32 + MedianTime time.Time + NumTxns uint64 + TotalTxns uint64 + type BlockChain struct + func New(config *Config) (*BlockChain, error) + func (b *BlockChain) AddHeader(header *wire.BlockHeader) error + func (b *BlockChain) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *chainhash.Hash) (*bchutil.Block, error) + func (b *BlockChain) BlockByHeight(blockHeight int32) (*bchutil.Block, error) + func (b *BlockChain) BlockHashByHeight(blockHeight int32) (*chainhash.Hash, error) + func (b *BlockChain) BlockHeightByHash(hash *chainhash.Hash) (int32, error) + func (b *BlockChain) BlockLocatorFromHash(hash *chainhash.Hash) BlockLocator + func (b *BlockChain) CachedStateSize() uint64 + func (b *BlockChain) CalcNextBlockVersion() (int32, error) + func (b *BlockChain) CalcNextRequiredDifficulty(timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcSequenceLock(tx *bchutil.Tx, utxoView *UtxoViewpoint, mempool bool) (*SequenceLock, error) + func (b *BlockChain) CheckConnectBlockTemplate(block *bchutil.Block) error + func (b *BlockChain) Checkpoints() []chaincfg.Checkpoint + func (b *BlockChain) FastSyncDoneChan() <-chan struct{} + func (b *BlockChain) FetchSpendJournal(targetBlock *bchutil.Block) ([]SpentTxOut, error) + func (b *BlockChain) FetchUtxoEntry(outpoint wire.OutPoint) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *bchutil.Tx) (*UtxoViewpoint, error) + func (b *BlockChain) FlushCachedState(mode FlushMode) error + func (b *BlockChain) GetOrphanRoot(hash *chainhash.Hash) *chainhash.Hash + func (b *BlockChain) HasCheckpoints() bool + func (b *BlockChain) HaveBlock(hash *chainhash.Hash) (bool, error) + func (b *BlockChain) HeaderByHash(hash *chainhash.Hash) (wire.BlockHeader, error) + func (b *BlockChain) HeightRange(startHeight, endHeight int32) ([]chainhash.Hash, error) + func (b *BlockChain) HeightToHashRange(startHeight int32, endHash *chainhash.Hash, maxResults int) ([]chainhash.Hash, error) + func (b *BlockChain) IntervalBlockHashes(endHash *chainhash.Hash, interval int) ([]chainhash.Hash, error) + func (b *BlockChain) IsCheckpointCandidate(block *bchutil.Block) (bool, error) + func (b *BlockChain) IsCurrent() bool + func (b *BlockChain) IsDeploymentActive(deploymentID uint32) (bool, error) + func (b *BlockChain) IsKnownOrphan(hash *chainhash.Hash) bool + func (b *BlockChain) IsPruned() bool + func (b *BlockChain) LatestBlockLocator() (BlockLocator, error) + func (b *BlockChain) LatestCheckpoint() *chaincfg.Checkpoint + 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) MainChainHasBlock(hash *chainhash.Hash) bool + func (b *BlockChain) MaxBlockSize(uahfActive bool) int + func (b *BlockChain) ProcessBlock(block *bchutil.Block, flags BehaviorFlags) (bool, bool, error) + func (b *BlockChain) Prune() error + func (b *BlockChain) PruneMode() bool + func (b *BlockChain) ReIndexChainState() error + func (b *BlockChain) ReconsiderBlock(hash *chainhash.Hash) error + func (b *BlockChain) RollbackUtxoSet(height int32) (*UtxoViewpoint, error) + func (b *BlockChain) SelectDifficultyAdjustmentAlgorithm(height int32) DifficultyAlgorithm + func (b *BlockChain) Subscribe(callback NotificationCallback) + func (b *BlockChain) ThresholdState(deploymentID uint32) (ThresholdState, error) + func (b *BlockChain) UtxoCacheFlushInProgress() bool + type BlockLocator []*chainhash.Hash + type Config struct + ChainParams *chaincfg.Params + Checkpoints []chaincfg.Checkpoint + DB database.DB + ExcessiveBlockSize uint32 + FastSync bool + FastSyncDataDir string + HashCache *txscript.HashCache + IndexManager IndexManager + Interrupt <-chan struct{} + Proxy string + Prune bool + PruneDepth uint32 + ReIndexChainState bool + SigCache *txscript.SigCache + TimeSource MedianTimeSource + UtxoCacheMaxSize uint64 + type DeploymentError uint32 + func (e DeploymentError) Error() string + type DifficultyAlgorithm uint32 + const DifficultyDAA + const DifficultyEDA + const DifficultyLegacy + type ErrorCode int + const ErrBadCheckpoint + const ErrBadCoinbaseHeight + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadTxInput + const ErrBadTxOutValue + const ErrBlockTooBig + const ErrBlockTooSmall + const ErrBlockVersionTooOld + const ErrCheckpointTimeTooOld + const ErrDifficultyTooLow + const ErrDuplicateBlock + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrFirstTxNotCoinbase + const ErrForkTooOld + const ErrHighHash + const ErrImmatureSpend + const ErrInvalidAncestorBlock + const ErrInvalidTime + const ErrInvalidTxOrder + const ErrMissingCoinbaseHeight + const ErrMissingTxOut + const ErrMultipleCoinbases + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrOverwriteTx + const ErrPrevBlockNotBest + const ErrPreviousBlockUnknown + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrSpentTxOut + const ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManySigOps + const ErrTxTooBig + const ErrTxTooManySigOps + const ErrTxTooSmall + const ErrUnexpectedDifficulty + const ErrUnfinalizedTx + func (e ErrorCode) String() string + type FlushMode uint8 + const FlushIfNeeded + const FlushPeriodic + const FlushRequired + type IndexManager interface + ConnectBlock func(database.Tx, *bchutil.Block, []SpentTxOut) error + DisconnectBlock func(database.Tx, *bchutil.Block, []SpentTxOut) 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 Notification struct + Data interface{} + Type NotificationType + type NotificationCallback func(*Notification) + type NotificationType int + const NTBlockAccepted + const NTBlockConnected + const NTBlockDisconnected + func (n NotificationType) String() string + type RuleError struct + Description string + ErrorCode ErrorCode + func (e RuleError) Error() string + type SequenceLock struct + BlockHeight int32 + Seconds int64 + type SpentTxOut struct + Amount int64 + Height int32 + IsCoinBase bool + PkScript []byte + type ThresholdState byte + const ThresholdActive + const ThresholdDefined + const ThresholdFailed + const ThresholdLockedIn + const ThresholdStarted + func (t ThresholdState) String() string + type UtxoEntry struct + func DeserializeUtxoEntry(serialized []byte) (*UtxoEntry, error) + func (entry *UtxoEntry) Amount() int64 + func (entry *UtxoEntry) BlockHeight() int32 + 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 *bchutil.Tx, txOutIdx uint32, blockHeight int32) + func (view *UtxoViewpoint) AddTxOuts(tx *bchutil.Tx, blockHeight int32) + func (view *UtxoViewpoint) Entries() map[wire.OutPoint]*UtxoEntry + func (view *UtxoViewpoint) LookupEntry(outpoint wire.OutPoint) *UtxoEntry + func (view *UtxoViewpoint) RemoveEntry(outpoint wire.OutPoint)