From c17cf800dceff7984f898029fa8fc03efd6b5f3d Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Mon, 22 Jan 2024 13:20:18 +0900 Subject: [PATCH] netsync: don't update mempool/fee estimator unless we're synced up Noticed during ibd that there's a slight overhead for handleBlockchainNotification on mempool/fee estimator updates. Since there's no reason to be looking at this while we're not caught up, return early and avoid the calls. --- netsync/manager.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netsync/manager.go b/netsync/manager.go index 41ba70aa6a..b1a4db4d13 100644 --- a/netsync/manager.go +++ b/netsync/manager.go @@ -1454,6 +1454,13 @@ func (sm *SyncManager) handleBlockchainNotification(notification *blockchain.Not // A block has been connected to the main block chain. case blockchain.NTBlockConnected: + // Don't attempt to update the mempool if we're not current. + // The mempool is empty and the fee estimator is useless unless + // we're caught up. + if !sm.current() { + return + } + block, ok := notification.Data.(*btcutil.Block) if !ok { log.Warnf("Chain connected notification is not a block.")