Versions in this module Expand all Collapse all v0 v0.0.20 Sep 9, 2023 v0.0.10 Sep 9, 2023 Changes in this version + const CheckpointConfirmations + const CoinbaseWitnessDataLen + const CoinbaseWitnessPkScriptLength + const MaxBlockBaseSize + const MaxBlockSigOpsCost + const MaxBlockWeight + const MaxCoinbaseScriptLen + const MaxOutputsPerBlock + const MaxTimeOffsetSeconds + const MinCoinbaseScriptLen + const MinTxOutputWeight + const WitnessScaleFactor + var WitnessMagicBytes = []byte + func BigToCompact(n *big.Int) uint32 + func BuildMerkleTreeStore(transactions []*ltcutil.Tx, witness bool) []*chainhash.Hash + func CalcBlockSubsidy(height int32, chainParams *chaincfg.Params) int64 + func CalcWork(bits uint32) *big.Int + func CheckBlockSanity(block *ltcutil.Block, powLimit *big.Int, timeSource MedianTimeSource) error + func CheckProofOfWork(block *ltcutil.Block, powLimit *big.Int) error + func CheckTransactionInputs(tx *ltcutil.Tx, txHeight int32, utxoView *UtxoViewpoint, ...) (int64, error) + func CheckTransactionSanity(tx *ltcutil.Tx) error + func CompactToBig(compact uint32) *big.Int + func CountP2SHSigOps(tx *ltcutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint) (int, error) + func CountSigOps(tx *ltcutil.Tx) int + func DisableLog() + func ExtractCoinbaseHeight(coinbaseTx *ltcutil.Tx) (int32, error) + func ExtractWitnessCommitment(tx *ltcutil.Tx) ([]byte, bool) + func GetBlockWeight(blk *ltcutil.Block) int64 + func GetSigOpCost(tx *ltcutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint, bip16, segWit bool) (int, error) + func GetTransactionWeight(tx *ltcutil.Tx) int64 + func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash + func HashToBig(hash *chainhash.Hash) *big.Int + func IsCoinBase(tx *ltcutil.Tx) bool + func IsCoinBaseTx(msgTx *wire.MsgTx) bool + func IsFinalizedTransaction(tx *ltcutil.Tx, blockHeight int32, blockTime time.Time) bool + func LockTimeToSequence(isSeconds bool, locktime uint32) uint32 + func SequenceLockActive(sequenceLock *SequenceLock, blockHeight int32, medianTimePast time.Time) bool + func ShouldHaveSerializedBlockHeight(header *wire.BlockHeader) bool + func UseLogger(logger btclog.Logger) + func ValidateTransactionScripts(tx *ltcutil.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + func ValidateWitnessCommitment(blk *ltcutil.Block) 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 + BlockWeight 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) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *chainhash.Hash) (*ltcutil.Block, error) + func (b *BlockChain) BlockByHeight(blockHeight int32) (*ltcutil.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) CalcNextBlockVersion() (int32, error) + func (b *BlockChain) CalcNextRequiredDifficulty(timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcSequenceLock(tx *ltcutil.Tx, utxoView *UtxoViewpoint, mempool bool) (*SequenceLock, error) + func (b *BlockChain) CheckConnectBlockTemplate(block *ltcutil.Block) error + func (b *BlockChain) Checkpoints() []chaincfg.Checkpoint + func (b *BlockChain) FetchSpendJournal(targetBlock *ltcutil.Block) ([]SpentTxOut, error) + func (b *BlockChain) FetchUtxoEntry(outpoint wire.OutPoint) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *ltcutil.Tx) (*UtxoViewpoint, 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 *ltcutil.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) 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) PastMedianTime(blockHeader *wire.BlockHeader) (time.Time, error) + func (b *BlockChain) ProcessBlock(block *ltcutil.Block, flags BehaviorFlags) (bool, bool, error) + func (b *BlockChain) Subscribe(callback NotificationCallback) + func (b *BlockChain) ThresholdState(deploymentID uint32) (ThresholdState, error) + type BlockLocator []*chainhash.Hash + type Config struct + ChainParams *chaincfg.Params + Checkpoints []chaincfg.Checkpoint + DB database.DB + HashCache *txscript.HashCache + IndexManager IndexManager + Interrupt <-chan struct{} + SigCache *txscript.SigCache + TimeSource MedianTimeSource + type DeploymentError uint32 + func (e DeploymentError) Error() string + type ErrorCode int + const ErrBadCheckpoint + const ErrBadCoinbaseHeight + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadTxInput + const ErrBadTxOutValue + const ErrBlockTooBig + const ErrBlockVersionTooOld + const ErrBlockWeightTooHigh + const ErrCheckpointTimeTooOld + const ErrDifficultyTooLow + const ErrDuplicateBlock + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrFirstTxNotCoinbase + const ErrForkTooOld + const ErrHighHash + const ErrImmatureSpend + const ErrInvalidAncestorBlock + const ErrInvalidTime + const ErrInvalidWitnessCommitment + 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 ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManySigOps + const ErrTxTooBig + const ErrUnexpectedDifficulty + const ErrUnexpectedWitness + const ErrUnfinalizedTx + const ErrWitnessCommitmentMismatch + func (e ErrorCode) String() string + type IndexManager interface + ConnectBlock func(database.Tx, *ltcutil.Block, []SpentTxOut) error + DisconnectBlock func(database.Tx, *ltcutil.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 NewUtxoEntry(txOut *wire.TxOut, blockHeight int32, isCoinbase bool) *UtxoEntry + 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 *ltcutil.Tx, txOutIdx uint32, blockHeight int32) + func (view *UtxoViewpoint) AddTxOuts(tx *ltcutil.Tx, blockHeight int32) + func (view *UtxoViewpoint) BestHash() *chainhash.Hash + func (view *UtxoViewpoint) Entries() map[wire.OutPoint]*UtxoEntry + func (view *UtxoViewpoint) LookupEntry(outpoint wire.OutPoint) *UtxoEntry + func (view *UtxoViewpoint) RemoveEntry(outpoint wire.OutPoint) + func (view *UtxoViewpoint) SetBestHash(hash *chainhash.Hash)