blockchain: set the lastflushtime when setting the lastflushhash

On startup when the headers-first mode is off, when receiving the first
block, the periodic flush will trigger.  The lastflushtime wasn't set
which resulted in the flush being triggered on the first block on
restart.
This commit is contained in:
Calvin Kim 2024-01-03 14:24:36 +09:00
parent b1b9420208
commit e307ad122f

View file

@ -634,6 +634,10 @@ func (b *BlockChain) InitConsistentState(tip *blockNode, interrupt <-chan struct
// it to the tip since we checked it's consistent.
s.lastFlushHash = tip.hash
// Set the last flush time as now since we know the state is consistent
// at this time.
s.lastFlushTime = time.Now()
return nil
}