mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core: truncate chain before the cutoff
This commit is contained in:
parent
e447da2305
commit
1e7f405fc5
1 changed files with 5 additions and 0 deletions
|
|
@ -2534,6 +2534,11 @@ func (bc *BlockChain) InsertHeadersBeforeCutoff(headers []*types.Header) (int, e
|
|||
if err := batch.Write(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// Truncate the useless chain segment (zero bodies and receipts) in the
|
||||
// ancient store.
|
||||
if _, err := bc.db.TruncateTail(last.Number.Uint64() + 1); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// Last step update all in-memory markers
|
||||
bc.hc.currentHeader.Store(last)
|
||||
bc.currentSnapBlock.Store(last)
|
||||
|
|
|
|||
Loading…
Reference in a new issue