Skip to content

Commit

Permalink
fix : flags, FLOCK lock
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsharma committed Jan 19, 2024
1 parent 65014b1 commit fcd5002
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 535 in core/blockchain.go

View check run for this annotation

Codecov / codecov/patch

core/blockchain.go#L534-L535

Added lines #L534 - L535 were not covered by tests
chainConfig, _, genesisErr := SetupGenesisBlockWithOverride(db, triedb, genesis, overrides)

Expand Down
20 changes: 16 additions & 4 deletions internal/cli/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions internal/cli/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<number>=<hash>)",
Expand Down

0 comments on commit fcd5002

Please sign in to comment.