chainntnfs+chainreg: add interface MempoolWatcher
This commit adds the interface `MempoolWatcher` and uses it in the chain registry.
This commit is contained in:
4 files changed
+34
-2
No files matched your search
@@ -80,6 +80,10 @@ type BitcoindNotifier struct {
|
||||
// time.
|
||||
var _ chainntnfs.ChainNotifier = (*BitcoindNotifier)(nil)
|
||||
|
||||
// Ensure BitcoindNotifier implements the MempoolWatcher interface at compile
|
||||
// time.
|
||||
var _ chainntnfs.MempoolWatcher = (*BitcoindNotifier)(nil)
|
||||
|
||||
// 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.
|
||||
|
||||
@@ -96,6 +96,9 @@ type BtcdNotifier struct {
|
||||
// Ensure BtcdNotifier implements the ChainNotifier interface at compile time.
|
||||
var _ chainntnfs.ChainNotifier = (*BtcdNotifier)(nil)
|
||||
|
||||
// Ensure BtcdNotifier implements the MempoolWatcher interface at compile time.
|
||||
var _ chainntnfs.MempoolWatcher = (*BtcdNotifier)(nil)
|
||||
|
||||
// New returns a new BtcdNotifier instance. This function assumes the btcd node
|
||||
// detailed in the passed configuration is already running, and willing to
|
||||
// accept new websockets clients.
|
||||
|
||||
@@ -808,3 +808,16 @@ type ConfirmHintCache interface {
|
||||
// the cache.
|
||||
PurgeConfirmHint(confRequests ...ConfRequest) error
|
||||
}
|
||||
|
||||
// MempoolWatcher defines an interface that allows the caller to query
|
||||
// information in the mempool.
|
||||
type MempoolWatcher interface {
|
||||
// SubscribeMempoolSpent allows the caller to register a subscription
|
||||
// to watch for a spend of an outpoint in the mempool.The event will be
|
||||
// dispatched once the outpoint is spent in the mempool.
|
||||
SubscribeMempoolSpent(op wire.OutPoint) (*MempoolSpendEvent, error)
|
||||
|
||||
// CancelMempoolSpendEvent allows the caller to cancel a subscription to
|
||||
// watch for a spend of an outpoint in the mempool.
|
||||
CancelMempoolSpendEvent(sub *MempoolSpendEvent)
|
||||
}
|
||||
Reference in new issue
Block a user