From b5f15312e41262df90a1eb2c09a6d743f151344d Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Mon, 18 Nov 2024 10:50:23 +0800 Subject: [PATCH 1/3] fix: fix multi-db env --- eth/backend.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/backend.go b/eth/backend.go index 14053f1450..556af40b4a 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -210,7 +210,11 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { } // startup ancient freeze - if err = chainDb.SetupFreezerEnv(ðdb.FreezerEnv{ + freezeDb := chainDb + if stack.CheckIfMultiDataBase() { + freezeDb = chainDb.BlockStore() + } + if err = freezeDb.SetupFreezerEnv(ðdb.FreezerEnv{ ChainCfg: chainConfig, BlobExtraReserve: config.BlobExtraReserve, }); err != nil { From 7523a64c9dfe0076d8727da7c781b7a92837de82 Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Mon, 18 Nov 2024 14:19:23 +0800 Subject: [PATCH 2/3] fix: fix multiDatabase flag --- core/rawdb/chain_freezer.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index 3a18281100..4953c81237 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -71,9 +71,10 @@ func newChainFreezer(datadir string, namespace string, readonly bool, offset uin return nil, err } cf := chainFreezer{ - Freezer: freezer, - quit: make(chan struct{}), - trigger: make(chan chan struct{}), + Freezer: freezer, + quit: make(chan struct{}), + trigger: make(chan chan struct{}), + multiDatabase: multiDatabase, } cf.threshold.Store(params.FullImmutabilityThreshold) return &cf, nil From bca9c5d3de8cbaa23989c06d1540a66d8fe03353 Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Tue, 19 Nov 2024 11:09:15 +0800 Subject: [PATCH 3/3] fix: force keep 9W blocks --- core/rawdb/chain_freezer.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index 4953c81237..fd52437027 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -71,10 +71,12 @@ func newChainFreezer(datadir string, namespace string, readonly bool, offset uin return nil, err } cf := chainFreezer{ - Freezer: freezer, - quit: make(chan struct{}), - trigger: make(chan chan struct{}), - multiDatabase: multiDatabase, + 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