Skip to content

Commit

Permalink
core: nuke legacy snapshot supporting
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Apr 20, 2021
1 parent 653b7e9 commit 58e9210
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 472 deletions.
15 changes: 4 additions & 11 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ type BlockChain struct {
processor Processor // Block transaction processor interface
vmConfig vm.Config

shouldPreserve func(*types.Block) bool // Function used to determine whether should preserve the given block.
terminateInsert func(common.Hash, uint64) bool // Testing hook used to terminate ancient receipt chain insertion.
writeLegacyJournal bool // Testing flag used to flush the snapshot journal in legacy format.
shouldPreserve func(*types.Block) bool // Function used to determine whether should preserve the given block.
terminateInsert func(common.Hash, uint64) bool // Testing hook used to terminate ancient receipt chain insertion.
}

// NewBlockChain returns a fully initialised block chain using information
Expand Down Expand Up @@ -1002,14 +1001,8 @@ func (bc *BlockChain) Stop() {
var snapBase common.Hash
if bc.snaps != nil {
var err error
if bc.writeLegacyJournal {
if snapBase, err = bc.snaps.LegacyJournal(bc.CurrentBlock().Root()); err != nil {
log.Error("Failed to journal state snapshot", "err", err)
}
} else {
if snapBase, err = bc.snaps.Journal(bc.CurrentBlock().Root()); err != nil {
log.Error("Failed to journal state snapshot", "err", err)
}
if snapBase, err = bc.snaps.Journal(bc.CurrentBlock().Root()); err != nil {
log.Error("Failed to journal state snapshot", "err", err)
}
}
// Ensure the state of a recent block is also stored to disk before exiting.
Expand Down
Loading

0 comments on commit 58e9210

Please sign in to comment.