mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
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:
parent
17fdc5219b
commit
c17cf800dc
1 changed files with 7 additions and 0 deletions
|
|
@ -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.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue