mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
core: fix broken test
This commit is contained in:
parent
24f6b1f4e7
commit
e4f7a372d6
2 changed files with 14 additions and 6 deletions
|
|
@ -155,6 +155,7 @@ type BlockChainConfig struct {
|
||||||
TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory
|
TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory
|
||||||
TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk
|
TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk
|
||||||
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
|
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
|
||||||
|
TrieNoAsyncFlush bool // Whether the asynchronous buffer flushing is disallowed
|
||||||
|
|
||||||
Preimages bool // Whether to store preimage of trie key to the disk
|
Preimages bool // Whether to store preimage of trie key to the disk
|
||||||
StateHistory uint64 // Number of blocks from head whose state histories are reserved.
|
StateHistory uint64 // Number of blocks from head whose state histories are reserved.
|
||||||
|
|
@ -200,7 +201,7 @@ func DefaultConfig() *BlockChainConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithArchive enabled/disables archive mode on the config.
|
// WithArchive enables/disables archive mode on the config.
|
||||||
func (cfg BlockChainConfig) WithArchive(on bool) *BlockChainConfig {
|
func (cfg BlockChainConfig) WithArchive(on bool) *BlockChainConfig {
|
||||||
cfg.ArchiveMode = on
|
cfg.ArchiveMode = on
|
||||||
return &cfg
|
return &cfg
|
||||||
|
|
@ -212,6 +213,12 @@ func (cfg BlockChainConfig) WithStateScheme(scheme string) *BlockChainConfig {
|
||||||
return &cfg
|
return &cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithNoAsyncFlush enables/disables asynchronous buffer flushing mode on the config.
|
||||||
|
func (cfg BlockChainConfig) WithNoAsyncFlush(on bool) *BlockChainConfig {
|
||||||
|
cfg.TrieNoAsyncFlush = on
|
||||||
|
return &cfg
|
||||||
|
}
|
||||||
|
|
||||||
// triedbConfig derives the configures for trie database.
|
// triedbConfig derives the configures for trie database.
|
||||||
func (cfg *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
|
func (cfg *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
|
||||||
config := &triedb.Config{
|
config := &triedb.Config{
|
||||||
|
|
@ -233,6 +240,7 @@ func (cfg *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
|
||||||
// for flushing both trie data and state data to disk. The config name
|
// for flushing both trie data and state data to disk. The config name
|
||||||
// should be updated to eliminate the confusion.
|
// should be updated to eliminate the confusion.
|
||||||
WriteBufferSize: cfg.TrieDirtyLimit * 1024 * 1024,
|
WriteBufferSize: cfg.TrieDirtyLimit * 1024 * 1024,
|
||||||
|
NoAsyncFlush: cfg.TrieNoAsyncFlush,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo
|
||||||
}
|
}
|
||||||
engine = ethash.NewFullFaker()
|
engine = ethash.NewFullFaker()
|
||||||
)
|
)
|
||||||
chain, err := NewBlockChain(db, gspec, engine, DefaultConfig().WithStateScheme(basic.scheme))
|
chain, err := NewBlockChain(db, gspec, engine, DefaultConfig().WithStateScheme(basic.scheme).WithNoAsyncFlush(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create chain: %v", err)
|
t.Fatalf("Failed to create chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -572,7 +572,7 @@ func TestHighCommitCrashWithNewSnapshot(t *testing.T) {
|
||||||
//
|
//
|
||||||
// Expected head header : C8
|
// Expected head header : C8
|
||||||
// Expected head fast block: C8
|
// Expected head fast block: C8
|
||||||
// Expected head block : G (Hash mode), C6 (Hash mode)
|
// Expected head block : G (Hash mode), C6 (Path mode)
|
||||||
// Expected snapshot disk : C4 (Hash mode)
|
// Expected snapshot disk : C4 (Hash mode)
|
||||||
for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} {
|
for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} {
|
||||||
expHead := uint64(0)
|
expHead := uint64(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue