Versions in this module Expand all Collapse all v0 v0.0.3 Sep 11, 2024 Changes in this version + const MaxNumConfs + const ReorgSafetyLimit + var ErrChainNotifierShuttingDown = errors.New("chain notifier shutting down") + var ErrConfirmHintNotFound = errors.New("confirm hint not found") + var ErrCorruptedHeightHintCache = errors.New(...) + var ErrEmptyWitnessStack = errors.New("witness stack is empty") + var ErrNoHeightHint = errors.New(...) + var ErrNoScript = errors.New("an output script must be provided") + var ErrNumConfsOutOfRange = fmt.Errorf(..., 1, MaxNumConfs) + var ErrSpendHintNotFound = errors.New("spend hint not found") + var ErrTxNotifierExiting = errors.New("TxNotifier is exiting") + var Log btclog.Logger + var ZeroHash chainhash.Hash + var ZeroOutPoint wire.OutPoint + var ZeroTaprootPkScript = txscript.ParsePkScript(zeroV1KeyPush[:]) + func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest, txNotFoundErr string) (*TxConfirmation, TxConfStatus, error) + func DisableLog() + func GetCommonBlockAncestorHeight(chainConn ChainConn, reorgHash, chainHash chainhash.Hash) (int32, error) + func HandleMissedBlocks(chainConn ChainConn, txNotifier *TxNotifier, currBestBlock BlockEpoch, ...) (BlockEpoch, []BlockEpoch, error) + func RegisterNotifier(driver *NotifierDriver) error + func SupportedNotifiers() []string + func UseLogger(logger btclog.Logger) + type BestBlockTracker struct + func NewBestBlockTracker(chainNotifier ChainNotifier) *BestBlockTracker + func (t *BestBlockTracker) BestBlockHeader() (*wire.BlockHeader, error) + func (t *BestBlockTracker) BestHeight() (uint32, error) + func (t *BestBlockTracker) Start() error + func (t *BestBlockTracker) Stop() error + type BestBlockView interface + BestBlockHeader func() (*wire.BlockHeader, error) + BestHeight func() (uint32, error) + type BlockEpoch struct + BlockHeader *wire.BlockHeader + Hash *chainhash.Hash + Height int32 + func GetClientMissedBlocks(chainConn ChainConn, clientBestBlock *BlockEpoch, notifierBestHeight int32, ...) ([]BlockEpoch, error) + func RewindChain(chainConn ChainConn, txNotifier *TxNotifier, currBestBlock BlockEpoch, ...) (BlockEpoch, error) + type BlockEpochEvent struct + Cancel func() + Epochs <-chan *BlockEpoch + type ChainConn interface + GetBlockHash func(blockHeight int64) (*chainhash.Hash, error) + GetBlockHeader func(blockHash *chainhash.Hash) (*wire.BlockHeader, error) + GetBlockHeaderVerbose func(blockHash *chainhash.Hash) (*btcjson.GetBlockHeaderVerboseResult, error) + type ChainNotifier interface + RegisterBlockEpochNtfn func(*BlockEpoch) (*BlockEpochEvent, error) + RegisterConfirmationsNtfn func(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32, ...) (*ConfirmationEvent, error) + RegisterSpendNtfn func(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*SpendEvent, error) + Start func() error + Started func() bool + Stop func() error + type ConfNtfn struct + ConfID uint64 + Event *ConfirmationEvent + HeightHint uint32 + NumConfirmations uint32 + type ConfRegistration struct + Event *ConfirmationEvent + Height uint32 + HistoricalDispatch *HistoricalConfDispatch + type ConfRequest struct + PkScript txscript.PkScript + TxID chainhash.Hash + func NewConfRequest(txid *chainhash.Hash, pkScript []byte) (ConfRequest, error) + func (r ConfRequest) MatchesTx(tx *wire.MsgTx) bool + func (r ConfRequest) String() string + type ConfirmHintCache interface + CommitConfirmHint func(height uint32, confRequests ...ConfRequest) error + PurgeConfirmHint func(confRequests ...ConfRequest) error + QueryConfirmHint func(confRequest ConfRequest) (uint32, error) + type ConfirmationEvent struct + Cancel func() + Confirmed chan *TxConfirmation + Done chan struct{} + NegativeConf chan int32 + Updates chan uint32 + func NewConfirmationEvent(numConfs uint32, cancel func()) *ConfirmationEvent + type HistoricalConfDispatch struct + EndHeight uint32 + StartHeight uint32 + type HistoricalSpendDispatch struct + EndHeight uint32 + StartHeight uint32 + type MempoolNotifier struct + func NewMempoolNotifier() *MempoolNotifier + func (m *MempoolNotifier) ProcessRelevantSpendTx(tx *btcutil.Tx) error + func (m *MempoolNotifier) SubscribeInput(outpoint wire.OutPoint) *MempoolSpendEvent + func (m *MempoolNotifier) TearDown() + func (m *MempoolNotifier) UnsubscribeEvent(sub *MempoolSpendEvent) + func (m *MempoolNotifier) UnsubscribeInput(outpoint wire.OutPoint) + func (m *MempoolNotifier) UnsubsribeConfirmedSpentTx(tx *btcutil.Tx) + type MempoolSpendEvent struct + Spend <-chan *SpendDetail + type MempoolWatcher interface + CancelMempoolSpendEvent func(sub *MempoolSpendEvent) + SubscribeMempoolSpent func(op wire.OutPoint) (*MempoolSpendEvent, error) + type NotifierDriver struct + New func(args ...interface{}) (ChainNotifier, error) + NotifierType string + func RegisteredNotifiers() []*NotifierDriver + type NotifierOption func(*notifierOptions) + func WithIncludeBlock() NotifierOption + type SpendDetail struct + SpenderInputIndex uint32 + SpenderTxHash *chainhash.Hash + SpendingHeight int32 + SpendingTx *wire.MsgTx + SpentOutPoint *wire.OutPoint + func (s *SpendDetail) HasSpenderWitness() bool + func (s *SpendDetail) String() string + type SpendEvent struct + Cancel func() + Done chan struct{} + Reorg chan struct{} + Spend chan *SpendDetail + func NewSpendEvent(cancel func()) *SpendEvent + type SpendHintCache interface + CommitSpendHint func(height uint32, spendRequests ...SpendRequest) error + PurgeSpendHint func(spendRequests ...SpendRequest) error + QuerySpendHint func(spendRequest SpendRequest) (uint32, error) + type SpendNtfn struct + Event *SpendEvent + HeightHint uint32 + SpendID uint64 + type SpendRegistration struct + Event *SpendEvent + Height uint32 + HistoricalDispatch *HistoricalSpendDispatch + type SpendRequest struct + OutPoint wire.OutPoint + PkScript txscript.PkScript + func NewSpendRequest(op *wire.OutPoint, pkScript []byte) (SpendRequest, error) + func (r SpendRequest) MatchesTx(tx *wire.MsgTx) (bool, uint32, error) + func (r SpendRequest) String() string + type TxConfStatus uint8 + const TxFoundIndex + const TxFoundManually + const TxFoundMempool + const TxNotFoundIndex + const TxNotFoundManually + func (t TxConfStatus) String() string + type TxConfirmation struct + Block *wire.MsgBlock + BlockHash *chainhash.Hash + BlockHeight uint32 + Tx *wire.MsgTx + TxIndex uint32 + type TxIndexConn interface + GetBlock func(*chainhash.Hash) (*wire.MsgBlock, error) + GetRawTransactionVerbose func(*chainhash.Hash) (*btcjson.TxRawResult, error) + type TxNotifier struct + func NewTxNotifier(startHeight uint32, reorgSafetyLimit uint32, confirmHintCache ConfirmHintCache, ...) *TxNotifier + func (n *TxNotifier) CancelConf(confRequest ConfRequest, confID uint64) + func (n *TxNotifier) CancelSpend(spendRequest SpendRequest, spendID uint64) + func (n *TxNotifier) ConnectTip(block *btcutil.Block, blockHeight uint32) error + func (n *TxNotifier) DisconnectTip(blockHeight uint32) error + func (n *TxNotifier) NotifyHeight(height uint32) error + func (n *TxNotifier) ProcessRelevantSpendTx(tx *btcutil.Tx, blockHeight uint32) error + func (n *TxNotifier) RegisterConf(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32, ...) (*ConfRegistration, error) + func (n *TxNotifier) RegisterSpend(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*SpendRegistration, error) + func (n *TxNotifier) TearDown() + func (n *TxNotifier) UpdateConfDetails(confRequest ConfRequest, details *TxConfirmation) error + func (n *TxNotifier) UpdateSpendDetails(spendRequest SpendRequest, details *SpendDetail) error