chainntnfs+chainreg: add interface MempoolWatcher

This commit adds the interface `MempoolWatcher` and uses it in the chain
registry.
This commit is contained in:
yyforyongyu committed 2023-04-19 01:18:19 +08:00
1 parent ad5e798392
commit e81d62fc70
4 files changed
+34 -2

No files matched your search

+13
View File
@@ -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)
}