Documentation ¶
Index ¶
- Variables
- type NeutrinoNotifier
- func (n *NeutrinoNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error)
- func (n *NeutrinoNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
- func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, heightHint uint32, _ bool) (*chainntnfs.SpendEvent, error)
- func (n *NeutrinoNotifier) Start() error
- func (n *NeutrinoNotifier) Stop() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrChainNotifierShuttingDown is used when we are trying to // measure a spend notification when notifier is already stopped. ErrChainNotifierShuttingDown = errors.New("chainntnfs: system interrupt " + "while attempting to register for spend notification.") )
Functions ¶
This section is empty.
Types ¶
type NeutrinoNotifier ¶
type NeutrinoNotifier struct {
// contains filtered or unexported fields
}
NeutrinoNotifier is a version of ChainNotifier that's backed by the neutrino Bitcoin light client. Unlike other implementations, this implementation speaks directly to the p2p network. As a result, this implementation of the ChainNotifier interface is much more light weight that other implementation which rely of receiving notification over an RPC interface backed by a running full node.
TODO(roasbeef): heavily consolidate with NeutrinoNotifier code
- maybe combine into single package?
func New ¶
func New(node *neutrino.ChainService) (*NeutrinoNotifier, error)
New creates a new instance of the NeutrinoNotifier concrete implementation of the ChainNotifier interface.
NOTE: The passed neutrino node should already be running and active before being passed into this function.
func (*NeutrinoNotifier) RegisterBlockEpochNtfn ¶
func (n *NeutrinoNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error)
RegisterBlockEpochNtfn returns a BlockEpochEvent which subscribes the caller to receive notifications, of each new block connected to the main chain.
func (*NeutrinoNotifier) RegisterConfirmationsNtfn ¶
func (n *NeutrinoNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
RegisterConfirmationsNtfn registers a notification with NeutrinoNotifier which will be triggered once the txid reaches numConfs number of confirmations.
func (*NeutrinoNotifier) RegisterSpendNtfn ¶
func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, heightHint uint32, _ bool) (*chainntnfs.SpendEvent, error)
RegisterSpendNtfn registers an intent to be notified once the target outpoint has been spent by a transaction on-chain. Once a spend of the target outpoint has been detected, the details of the spending event will be sent across the 'Spend' channel.
func (*NeutrinoNotifier) Start ¶
func (n *NeutrinoNotifier) Start() error
Start contacts the running neutrino light client and kicks off an initial empty rescan.
func (*NeutrinoNotifier) Stop ¶
func (n *NeutrinoNotifier) Stop() error
Stop shuts down the NeutrinoNotifier.