feat: init genesis
This commit is contained in:
parent
6cf5169ce1
commit
e1a2b8e8d6
@ -196,6 +196,9 @@ func (c *CacheConfig) triedbConfig() *triedb.Config {
|
||||
JournalFile: c.JournalFile,
|
||||
}
|
||||
}
|
||||
if c.StateScheme == rawdb.VersionScheme {
|
||||
config.IsVersion = true
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ func flushAlloc(ga *types.GenesisAlloc, db ethdb.Database, triedb *triedb.Databa
|
||||
return err
|
||||
}
|
||||
// Commit newly generated states into disk if it's not empty.
|
||||
if root != types.EmptyRootHash {
|
||||
if root != types.EmptyRootHash && triedb.Scheme() != rawdb.VersionScheme {
|
||||
if err := triedb.Commit(root, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ func (cv *cachingVersaDB) OpenTrie(root common.Hash) (Trie, error) {
|
||||
panic("account tree has open")
|
||||
}
|
||||
|
||||
// TODO:: if root tree, versa db shouldb ignore check version
|
||||
state, err := cv.versionDB.OpenState(0, root, cv.mode)
|
||||
// TODO:: if root tree, versa db should ignore check version, temp use -1
|
||||
state, err := cv.versionDB.OpenState(-1, root, cv.mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -12,7 +12,7 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2
|
||||
github.com/bnb-chain/fastssz v0.1.2
|
||||
github.com/bnb-chain/ics23 v0.1.0
|
||||
github.com/bnb-chain/versioned-state-database v0.0.0-20240809035848-76ffc0e09a92
|
||||
github.com/bnb-chain/versioned-state-database v0.0.0-00010101000000-000000000000
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
||||
github.com/cespare/cp v1.1.1
|
||||
github.com/cloudflare/cloudflare-go v0.79.0
|
||||
|
@ -96,7 +96,7 @@ type Database struct {
|
||||
// NewDatabase initializes the trie database with default settings, note
|
||||
// the legacy hash-based scheme is used by default.
|
||||
func NewDatabase(diskdb ethdb.Database, config *Config) *Database {
|
||||
if config.IsVersion {
|
||||
if config != nil && config.IsVersion {
|
||||
// TODO:: Wait for debugging to stabilize, and then consider initialization compatibility with other databases
|
||||
db := &Database{
|
||||
config: config,
|
||||
|
Loading…
Reference in New Issue
Block a user