Skip to content

Commit

Permalink
core: refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed Apr 15, 2024
1 parent b76e390 commit 5640825
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ func showMetaData(ctx *cli.Context) error {
if err != nil {
fmt.Fprintf(os.Stderr, "Error accessing ancients: %v", err)
}
data := rawdb.ReadChainMetadataCmd(db)
data := rawdb.ReadChainMetadataFromMultiDatabase(db)
data = append(data, []string{"frozen", fmt.Sprintf("%d items", ancients)})
data = append(data, []string{"snapshotGenerator", snapshot.ParseGeneratorStatus(rawdb.ReadSnapshotGenerator(db))})
if b := rawdb.ReadHeadBlock(db); b != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ func ReadChainMetadata(db ethdb.KeyValueStore) [][]string {
return data
}

func ReadChainMetadataCmd(db ethdb.Database) [][]string {
func ReadChainMetadataFromMultiDatabase(db ethdb.Database) [][]string {
pp := func(val *uint64) string {
if val == nil {
return "<nil>"
Expand Down
6 changes: 3 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,12 +820,12 @@ func (n *Node) OpenAndMergeDatabase(name string, namespace string, readonly bool
disableChainDbFreeze = true

// Allocate half of the handles and chainDbCache to this separate state data database
stateDiskDb, err = n.OpenDatabaseWithFreezer(name+"/state", stateDbCache, stateDbHandles, "", "eth/db/statedata/", readonly, true, false, config.PruneAncientData)
stateDiskDb, err = n.OpenDatabaseWithFreezer(name+"/state", stateDbCache, stateDbHandles, "", "eth/db/state/", readonly, true, false, config.PruneAncientData)
if err != nil {
return nil, err
}

blockDb, err = n.OpenDatabaseWithFreezer(name+"/block", blockDbCacheSize, blockDbHandlesSize, "", "eth/db/blockdata/", readonly, false, false, config.PruneAncientData)
blockDb, err = n.OpenDatabaseWithFreezer(name+"/block", blockDbCacheSize, blockDbHandlesSize, "", "eth/db/block/", readonly, false, false, config.PruneAncientData)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -913,7 +913,7 @@ func (n *Node) CheckIfMultiDataBase() bool {
} else if !stateExist && !blockExist {
return false
} else {
panic("block datadir is missing")
panic("data corruption! missing block or state dir.")
}
}

Expand Down

0 comments on commit 5640825

Please sign in to comment.