Skip to content

Commit

Permalink
fix commiting oldest node from triegc in BlockChain.Stop
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Oct 10, 2023
1 parent f5e52cb commit f084047
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,9 @@ func (bc *BlockChain) Stop() {
triedb := bc.triedb

for _, offset := range []uint64{0, 1, bc.cacheConfig.TriesInMemory - 1, math.MaxUint64} {
if number := bc.CurrentBlock().Number.Uint64(); number > offset {
if number := bc.CurrentBlock().Number.Uint64(); number > offset || offset == math.MaxUint64 {
var recent *types.Block
if offset == math.MaxUint && !bc.triegc.Empty() {
if offset == math.MaxUint64 && !bc.triegc.Empty() {
_, latest := bc.triegc.Peek()
recent = bc.GetBlockByNumber(uint64(-latest))
} else {
Expand Down

0 comments on commit f084047

Please sign in to comment.