Skip to content

Commit

Permalink
fix: fix multi-db env (#2755)
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi authored Nov 22, 2024
1 parent 6056007 commit f6d3203
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/rawdb/chain_freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func newChainFreezer(datadir string, namespace string, readonly bool, offset uin
Freezer: freezer,
quit: make(chan struct{}),
trigger: make(chan chan struct{}),
// After enabling pruneAncient, the ancient data is not retained. In some specific scenarios where it is
// necessary to roll back to blocks prior to the finalized block, it is mandatory to keep the most recent 90,000 blocks in the database to ensure proper functionality and rollback capability.
multiDatabase: false,
}
cf.threshold.Store(params.FullImmutabilityThreshold)
return &cf, nil
Expand Down
6 changes: 5 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}

// startup ancient freeze
if err = chainDb.SetupFreezerEnv(&ethdb.FreezerEnv{
freezeDb := chainDb
if stack.CheckIfMultiDataBase() {
freezeDb = chainDb.BlockStore()
}
if err = freezeDb.SetupFreezerEnv(&ethdb.FreezerEnv{
ChainCfg: chainConfig,
BlobExtraReserve: config.BlobExtraReserve,
}); err != nil {
Expand Down

0 comments on commit f6d3203

Please sign in to comment.