Skip to content

Commit

Permalink
netsync: don't update mempool/fee estimator unless we're synced up
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kcalvinalvin committed Jan 22, 2024
1 parent 17fdc52 commit ca1f5d4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions netsync/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit ca1f5d4

Please sign in to comment.