mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
chainntnfs+chainreg: add interface MempoolWatcher
This commit adds the interface `MempoolWatcher` and uses it in the chain registry.
This commit is contained in:
@@ -182,6 +182,10 @@ type PartialChainControl struct {
|
||||
// interested in.
|
||||
ChainNotifier chainntnfs.ChainNotifier
|
||||
|
||||
// MempoolNotifier is used to watch for spending events happened in
|
||||
// mempool.
|
||||
MempoolNotifier chainntnfs.MempoolWatcher
|
||||
|
||||
// ChainView is used in the router for maintaining an up-to-date graph.
|
||||
ChainView chainview.FilteredChainView
|
||||
|
||||
@@ -433,10 +437,14 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
"bitcoind: %v", err)
|
||||
}
|
||||
|
||||
cc.ChainNotifier = bitcoindnotify.New(
|
||||
chainNotifier := bitcoindnotify.New(
|
||||
bitcoindConn, cfg.ActiveNetParams.Params, hintCache,
|
||||
hintCache, cfg.BlockCache,
|
||||
)
|
||||
|
||||
cc.ChainNotifier = chainNotifier
|
||||
cc.MempoolNotifier = chainNotifier
|
||||
|
||||
cc.ChainView = chainview.NewBitcoindFilteredChainView(
|
||||
bitcoindConn, cfg.BlockCache,
|
||||
)
|
||||
@@ -655,7 +663,8 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
DisableConnectOnNew: true,
|
||||
DisableAutoReconnect: false,
|
||||
}
|
||||
cc.ChainNotifier, err = btcdnotify.New(
|
||||
|
||||
chainNotifier, err := btcdnotify.New(
|
||||
rpcConfig, cfg.ActiveNetParams.Params, hintCache,
|
||||
hintCache, cfg.BlockCache,
|
||||
)
|
||||
@@ -663,6 +672,9 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
cc.ChainNotifier = chainNotifier
|
||||
cc.MempoolNotifier = chainNotifier
|
||||
|
||||
// Finally, we'll create an instance of the default chain view
|
||||
// to be used within the routing layer.
|
||||
cc.ChainView, err = chainview.NewBtcdFilteredChainView(
|
||||
|
Reference in New Issue
Block a user