diff --git a/core/blockchain.go b/core/blockchain.go index f5fb535aef..5ea7387715 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -531,7 +531,7 @@ func NewParallelBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis } // Open trie database with provided config - triedb := trie.NewDatabase(db, cacheConfig.triedbConfig()) + triedb := bc.triedb chainConfig, _, genesisErr := SetupGenesisBlockWithOverride(db, triedb, genesis, overrides) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index fd32a945af..3ca4eae5ad 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -84,6 +84,9 @@ type Config struct { // GcMode selects the garbage collection mode for the trie GcMode string `hcl:"gcmode,optional" toml:"gcmode,optional"` + // state.scheme selects the Scheme to use for storing ethereum state ('hash' or 'path') + StateScheme string `hcl:"state.scheme,optional" toml:"state.scheme,optional"` + // Snapshot enables the snapshot database mode Snapshot bool `hcl:"snapshot,optional" toml:"snapshot,optional"` @@ -638,10 +641,11 @@ func DefaultConfig() *Config { Without: false, GRPCAddress: "", }, - SyncMode: "full", - GcMode: "full", - Snapshot: true, - BorLogs: false, + SyncMode: "full", + GcMode: "full", + StateScheme: "hash", + Snapshot: true, + BorLogs: false, TxPool: &TxPoolConfig{ Locals: []string{}, NoLocals: false, @@ -1164,6 +1168,14 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* return nil, fmt.Errorf("gcmode '%s' not found", c.GcMode) } + // statescheme "hash" or "path" + switch c.StateScheme { + case "path": + n.StateScheme = "path" + default: + n.StateScheme = "hash" + } + // snapshot disable check if !c.Snapshot { if n.SyncMode == downloader.SnapSync { diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 1f1745cc21..3a691e43c1 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -98,6 +98,12 @@ func (c *Command) Flags(config *Config) *flagset.Flagset { Value: &c.cliConfig.GcMode, Default: c.cliConfig.GcMode, }) + f.StringFlag(&flagset.StringFlag{ + Name: "state.scheme", + Usage: "Scheme to use for storing ethereum state ('hash' or 'path')", + Value: &c.cliConfig.StateScheme, + Default: c.cliConfig.StateScheme, + }) f.MapStringFlag(&flagset.MapStringFlag{ Name: "eth.requiredblocks", Usage: "Comma separated block number-to-hash mappings to require for peering (=)",