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.
This commit is contained in:
Calvin Kim 2024-01-22 13:20:18 +09:00
parent 17fdc5219b
commit c17cf800dc

View file

@ -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.")