Documentation ¶
Index ¶
- type ClientConnected
- type Consumer
- func (c *Consumer) Id() uint64
- func (c *Consumer) Notifications() <-chan interface{}
- func (c *Consumer) NotifyBlocks() error
- func (c *Consumer) NotifyReceived(scripts []string) error
- func (c *Consumer) NotifySpent(outPoints []*elements.OutPoint) error
- func (c *Consumer) NotifyTx(txids []chainhash.Hash) error
- func (c *Consumer) Start() error
- func (c *Consumer) Stop()
- type RelevantTx
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConnected ¶
type ClientConnected struct{}
ClientConnected is a notification for when a client connection is opened or reestablished to the chain server.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer ...
func (*Consumer) Notifications ¶
func (c *Consumer) Notifications() <-chan interface{}
Notifications returns a channel to retrieve notifications from.
NOTE: This is part of the chain.Interface interface.
func (*Consumer) NotifyBlocks ¶
NotifyBlocks allows the chain backend to notify the caller whenever a block is connected or disconnected.
NOTE: This is part of the chain.Interface interface.
func (*Consumer) NotifyReceived ¶
NotifyReceived allows the chain backend to notify the caller whenever a transaction pays to any of the given scripts hex.
NOTE: This is part of the chain.Interface interface.
func (*Consumer) NotifySpent ¶
NotifySpent allows the chain backend to notify the caller whenever a transaction spends any of the given outpoints.
func (*Consumer) NotifyTx ¶
NotifyTx allows the chain backend to notify the caller whenever any of the given transactions confirm within the chain.
type RelevantTx ¶
type RelevantTx struct { TxRecord *elements.TransactionExtended Block *elements.BlockID // nil if unmined }
RelevantTx is a notification for a transaction which spends wallet inputs or pays to a watched address.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber ...
func NewSubscriber ¶
func NewSubscriber(chain *network.Network, jsonrpcEndpoint, zmqBlockHost, zmqTxHost string, zmqPollInterval time.Duration) (*Subscriber, error)
NewSubscriber ...
func (*Subscriber) AddClient ¶
func (s *Subscriber) AddClient(client *Consumer)
AddClient adds a client to the set of active rescan clients of the current chain connection. This allows the connection to include the specified client in its notification delivery.
NOTE: This function is safe for concurrent access.
func (*Subscriber) NewConsumer ¶
func (s *Subscriber) NewConsumer() *Consumer
NewConsumer returns a bitcoind client using the current bitcoind connection. This allows us to share the same connection using multiple clients.
func (*Subscriber) RemoveClient ¶
func (s *Subscriber) RemoveClient(id uint64)
RemoveClient removes the client with the given ID from the set of active rescan clients. Once removed, the client will no longer receive block and transaction notifications from the chain connection.
NOTE: This function is safe for concurrent access.
func (*Subscriber) Start ¶
func (s *Subscriber) Start() error
Start attempts to establish a RPC and ZMQ connection to a elements node. If successful, a goroutine is spawned to read events from the ZMQ connection. It's possible for this function to fail due to a limited number of connection attempts. This is done to prevent waiting forever on the connection to be established in the case that the node is down.
func (*Subscriber) Stop ¶
func (s *Subscriber) Stop()
Stop terminates the RPC and ZMQ connection to a elementsd node and removes any active rescan clients.