mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
instantiate a new db with the same config as the chaindata db but without data
This commit is contained in:
parent
fcc66a59ea
commit
ec7775d2c8
2 changed files with 8 additions and 3 deletions
|
|
@ -90,7 +90,7 @@ type BlockChain struct {
|
|||
cacheConfig *CacheConfig // Cache configuration for pruning
|
||||
|
||||
db ethdb.Database // Low level persistent database to store final content in
|
||||
blockExplorerDb int
|
||||
blockExplorerDb ethdb.Database
|
||||
|
||||
triegc *prque.Prque // Priority queue mapping block numbers to tries to gc
|
||||
gcproc time.Duration // Accumulates canonical block processing for trie dumping
|
||||
|
|
@ -153,7 +153,7 @@ func NewBlockChain(db ethdb.Database, blockExplorerDb ethdb.Database, cacheConfi
|
|||
chainConfig: chainConfig,
|
||||
cacheConfig: cacheConfig,
|
||||
db: db,
|
||||
blockExplorerDb: 101,
|
||||
blockExplorerDb: blockExplorerDb,
|
||||
triegc: prque.New(),
|
||||
stateCache: state.NewDatabase(db),
|
||||
quit: make(chan struct{}),
|
||||
|
|
|
|||
|
|
@ -115,7 +115,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// @NOTE:shyft instantiate BlockExplorerDB here?
|
||||
blockExplorerDb, err := CreateDB(ctx, config, "blockExplorerDb")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stopDbUpgrade := upgradeDeduplicateData(chainDb)
|
||||
chainConfig, genesisHash, genesisErr := core.SetupGenesisBlock(chainDb, config.Genesis)
|
||||
if _, ok := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !ok {
|
||||
|
|
@ -153,7 +158,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
vmConfig = vm.Config{EnablePreimageRecording: config.EnablePreimageRecording}
|
||||
cacheConfig = &core.CacheConfig{Disabled: config.NoPruning, TrieNodeLimit: config.TrieCache, TrieTimeLimit: config.TrieTimeout}
|
||||
)
|
||||
eth.blockchain, err = core.NewBlockChain(chainDb, chainDb, cacheConfig, eth.chainConfig, eth.engine, vmConfig)
|
||||
eth.blockchain, err = core.NewBlockChain(chainDb, blockExplorerDb, cacheConfig, eth.chainConfig, eth.engine, vmConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue