bitcoindnotify

package
v0.4.2-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 BitcoindNotifier

type BitcoindNotifier struct {
	// contains filtered or unexported fields
}

BitcoindNotifier implements the ChainNotifier interface using a bitcoind chain client. Multiple concurrent clients are supported. All notifications are achieved via non-blocking sends on client channels.

func New

func New(config *rpcclient.ConnConfig, zmqConnect string,
	params chaincfg.Params) (*BitcoindNotifier, error)

New returns a new BitcoindNotifier instance. This function assumes the bitcoind node detailed in the passed configuration is already running, and willing to accept RPC requests and new zmq clients.

func (*BitcoindNotifier) RegisterBlockEpochNtfn

func (b *BitcoindNotifier) 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 (*BitcoindNotifier) RegisterConfirmationsNtfn

func (b *BitcoindNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
	numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error)

RegisterConfirmationsNtfn registers a notification with BitcoindNotifier which will be triggered once the txid reaches numConfs number of confirmations.

func (*BitcoindNotifier) RegisterSpendNtfn

func (b *BitcoindNotifier) 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. The heightHint should represent the earliest height in the chain where the transaction could have been spent in.

func (*BitcoindNotifier) Start

func (b *BitcoindNotifier) Start() error

Start connects to the running bitcoind node over websockets, registers for block notifications, and finally launches all related helper goroutines.

func (*BitcoindNotifier) Stop

func (b *BitcoindNotifier) Stop() error

Stop shutsdown the BitcoindNotifier.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL