Documentation ¶
Index ¶
- Variables
- type PfcdNotifier
- func (b *PfcdNotifier) RegisterBlockEpochNtfn(bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error)
- func (b *PfcdNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
- func (b *PfcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
- func (b *PfcdNotifier) Start() error
- func (b *PfcdNotifier) 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 PfcdNotifier ¶
type PfcdNotifier struct {
// contains filtered or unexported fields
}
PfcdNotifier implements the ChainNotifier interface using pfcd'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, spendHintCache chainntnfs.SpendHintCache, confirmHintCache chainntnfs.ConfirmHintCache) (*PfcdNotifier, error)
New returns a new PfcdNotifier instance. This function assumes the pfcd node detailed in the passed configuration is already running, and willing to accept new websockets clients.
func (*PfcdNotifier) RegisterBlockEpochNtfn ¶
func (b *PfcdNotifier) 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.
func (*PfcdNotifier) RegisterConfirmationsNtfn ¶
func (b *PfcdNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)
RegisterConfirmationsNtfn registers a notification with PfcdNotifier which will be triggered once the txid reaches numConfs number of confirmations.
func (*PfcdNotifier) RegisterSpendNtfn ¶
func (b *PfcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*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. The heightHint should represent the earliest height in the chain where the transaction could have been spent in.
func (*PfcdNotifier) Start ¶
func (b *PfcdNotifier) Start() error
Start connects to the running pfcd node over websockets, registers for block notifications, and finally launches all related helper goroutines.