From 5640825f3f457f8210eeb9e805a72efdbb2bc92b Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Mon, 15 Apr 2024 10:26:52 +0800 Subject: [PATCH] core: refine code --- cmd/geth/dbcmd.go | 2 +- core/rawdb/database.go | 2 +- node/node.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/geth/dbcmd.go b/cmd/geth/dbcmd.go index 968f71e1d7..f91ab65e12 100644 --- a/cmd/geth/dbcmd.go +++ b/cmd/geth/dbcmd.go @@ -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 { diff --git a/core/rawdb/database.go b/core/rawdb/database.go index f5c4e3fc94..f6143ec0c6 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -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 "" diff --git a/node/node.go b/node/node.go index 0b721d8f5f..9f0eaabe50 100644 --- a/node/node.go +++ b/node/node.go @@ -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 } @@ -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.") } }