mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
use a constant for the default value
This commit is contained in:
parent
b7c1d9166b
commit
319a9054f7
4 changed files with 8 additions and 5 deletions
|
|
@ -92,7 +92,7 @@ func TestProcessUBT(t *testing.T) {
|
|||
// genesis := gspec.MustCommit(bcdb, triedb)
|
||||
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||
options.SnapshotLimit = 0
|
||||
options.BinTrieGroupDepth = 8
|
||||
options.BinTrieGroupDepth = triedb.DefaultBinTrieGroupDepth
|
||||
blockchain, _ := NewBlockChain(bcdb, gspec, beacon.New(ethash.NewFaker()), options)
|
||||
defer blockchain.Stop()
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ func TestProcessParentBlockHash(t *testing.T) {
|
|||
t.Run("UBT", func(t *testing.T) {
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
cacheConfig := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||
cacheConfig.BinTrieGroupDepth = 8
|
||||
cacheConfig.BinTrieGroupDepth = triedb.DefaultBinTrieGroupDepth
|
||||
cacheConfig.SnapshotLimit = 0
|
||||
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))
|
||||
statedb, _ := state.New(types.EmptyBinaryHash, state.NewDatabase(triedb, nil))
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ func TestBinaryGenesisCommit(t *testing.T) {
|
|||
triedb := triedb.NewDatabase(db, &triedb.Config{
|
||||
IsUBT: true,
|
||||
PathDB: &config,
|
||||
BinTrieGroupDepth: 8,
|
||||
BinTrieGroupDepth: triedb.DefaultBinTrieGroupDepth,
|
||||
})
|
||||
block := genesis.MustCommit(db, triedb)
|
||||
if !bytes.Equal(block.Root().Bytes(), expected) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/miner"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/triedb"
|
||||
"github.com/ethereum/go-ethereum/triedb/pathdb"
|
||||
)
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ var Defaults = Config{
|
|||
StateHistory: pathdb.Defaults.StateHistory,
|
||||
TrienodeHistory: pathdb.Defaults.TrienodeHistory,
|
||||
NodeFullValueCheckpoint: pathdb.Defaults.FullValueCheckpoint,
|
||||
BinTrieGroupDepth: 8, // byte-aligned groups by default
|
||||
BinTrieGroupDepth: triedb.DefaultBinTrieGroupDepth,
|
||||
DatabaseCache: 2048,
|
||||
TrieCleanCache: 614,
|
||||
TrieDirtyCache: 1024,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ type Config struct {
|
|||
PathDB *pathdb.Config // Configs for experimental path-based scheme
|
||||
}
|
||||
|
||||
const DefaultBinTrieGroupDepth = 5
|
||||
|
||||
// HashDefaults represents a config for using hash-based scheme with
|
||||
// default settings.
|
||||
var HashDefaults = &Config{
|
||||
|
|
@ -51,7 +53,7 @@ var HashDefaults = &Config{
|
|||
var UBTDefaults = &Config{
|
||||
Preimages: false,
|
||||
IsUBT: true,
|
||||
BinTrieGroupDepth: 8, // Default to byte-aligned groups
|
||||
BinTrieGroupDepth: DefaultBinTrieGroupDepth,
|
||||
PathDB: pathdb.Defaults,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue