From 7c403b439c5de2714517c7a1820941677b305e11 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Wed, 12 Jul 2023 16:28:26 -0600 Subject: [PATCH] chainreg: Add BestBlockTracker to ChainControl This commit takes the best block tracker and adds it to the ChainControl objects and appropriately initializes it on ChainControl creation --- chainreg/chainregistry.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chainreg/chainregistry.go b/chainreg/chainregistry.go index 3c54a0aef..93d5c1dd1 100644 --- a/chainreg/chainregistry.go +++ b/chainreg/chainregistry.go @@ -145,6 +145,10 @@ type PartialChainControl struct { // interested in. ChainNotifier chainntnfs.ChainNotifier + // BestBlockTracker is used to maintain a view of the global + // chain state that changes over time + BestBlockTracker *chainntnfs.BestBlockTracker + // MempoolNotifier is used to watch for spending events happened in // mempool. MempoolNotifier chainntnfs.MempoolWatcher @@ -667,6 +671,9 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) { cfg.Bitcoin.Node) } + cc.BestBlockTracker = + chainntnfs.NewBestBlockTracker(cc.ChainNotifier) + switch { // If the fee URL isn't set, and the user is running mainnet, then // we'll return an error to instruct them to set a proper fee