Documentation ¶
Index ¶
- type BrondNotifier
- func (b *BrondNotifier) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error)
- func (b *BrondNotifier) RegisterBlockEpochNtfn(bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error)
- func (b *BrondNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
- func (b *BrondNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
- func (b *BrondNotifier) Start() error
- func (b *BrondNotifier) Started() bool
- func (b *BrondNotifier) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrondNotifier ¶
type BrondNotifier struct {
// contains filtered or unexported fields
}
BrondNotifier implements the ChainNotifier interface using brond's websockets notifications. Multiple concurrent clients are supported. All notifications are achieved via non-blocking sends on client channels.
func New ¶
func New(config *rpcclient.ConnConfig, chainParams *chaincfg.Params, spendHintCache chainntnfs.SpendHintCache, confirmHintCache chainntnfs.ConfirmHintCache, blockCache *blockcache.BlockCache) (*BrondNotifier, error)
New returns a new BrondNotifier instance. This function assumes the brond node detailed in the passed configuration is already running, and willing to accept new websockets clients.
func (*BrondNotifier) GetBlock ¶
GetBlock is used to retrieve the block with the given hash. This function wraps the blockCache's GetBlock function.
func (*BrondNotifier) RegisterBlockEpochNtfn ¶
func (b *BrondNotifier) RegisterBlockEpochNtfn( bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error)
RegisterBlockEpochNtfn returns a BlockEpochEvent which subscribes the caller to receive notifications, of each new block connected to the main chain. Clients have the option of passing in their best known block, which the notifier uses to check if they are behind on blocks and catch them up. If they do not provide one, then a notification will be dispatched immediately for the current tip of the chain upon a successful registration.
func (*BrondNotifier) RegisterConfirmationsNtfn ¶
func (b *BrondNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
RegisterConfirmationsNtfn registers an intent to be notified once the target txid/output script has reached numConfs confirmations on-chain. When intending to be notified of the confirmation of an output script, a nil txid must be used. The heightHint should represent the earliest height at which the txid/output script could have been included in the chain.
Progress on the number of confirmations left can be read from the 'Updates' channel. Once it has reached all of its confirmations, a notification will be sent across the 'Confirmed' channel.
func (*BrondNotifier) RegisterSpendNtfn ¶
func (b *BrondNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
RegisterSpendNtfn registers an intent to be notified once the target outpoint/output script has been spent by a transaction on-chain. When intending to be notified of the spend of an output script, a nil outpoint must be used. The heightHint should represent the earliest height in the chain of the transaction that spent the outpoint/output script.
Once a spend of has been detected, the details of the spending event will be sent across the 'Spend' channel.
func (*BrondNotifier) Start ¶
func (b *BrondNotifier) Start() error
Start connects to the running brond node over websockets, registers for block notifications, and finally launches all related helper goroutines.
func (*BrondNotifier) Started ¶
func (b *BrondNotifier) Started() bool
Started returns true if this instance has been started, and false otherwise.