From 2adc12892426a34c9fece34e923fdd9409474ebb Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Thu, 21 Mar 2024 09:43:44 +0800 Subject: [PATCH] cmd/geth: improve format --- cmd/geth/dbcmd.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/geth/dbcmd.go b/cmd/geth/dbcmd.go index 1054d0b52c..4e91a4ff25 100644 --- a/cmd/geth/dbcmd.go +++ b/cmd/geth/dbcmd.go @@ -800,7 +800,7 @@ func inspectAccount(db *triedb.Database, start uint64, end uint64, address commo content = "" } else { if !raw { - content = fmt.Sprintf("%x", stats.Origins[i]) + content = fmt.Sprintf("%#x", stats.Origins[i]) } else { account := new(types.SlimAccount) if err := rlp.DecodeBytes(stats.Origins[i], account); err != nil { @@ -808,13 +808,13 @@ func inspectAccount(db *triedb.Database, start uint64, end uint64, address commo } code := "" if len(account.CodeHash) > 0 { - code = fmt.Sprintf("%x", account.CodeHash) + code = fmt.Sprintf("%#x", account.CodeHash) } root := "" if len(account.Root) > 0 { - root = fmt.Sprintf("%x", account.Root) + root = fmt.Sprintf("%#x", account.Root) } - content = fmt.Sprintf("nonce: %d, balance: %d, code: %s, root: %s", account.Nonce, account.Balance, code, root) + content = fmt.Sprintf("nonce: %d, balance: %d, codeHash: %s, root: %s", account.Nonce, account.Balance, code, root) } } fmt.Printf("#%d - #%d: %s\n", from, stats.Blocks[i], content) @@ -840,14 +840,14 @@ func inspectStorage(db *triedb.Database, start uint64, end uint64, address commo content = "" } else { if !raw { - content = fmt.Sprintf("%x", stats.Origins[i]) + content = fmt.Sprintf("%#x", stats.Origins[i]) } else { _, data, _, err := rlp.Split(stats.Origins[i]) if err != nil { fmt.Printf("Failed to decode storage slot, %v", err) return err } - content = fmt.Sprintf("%x", data) + content = fmt.Sprintf("%#x", data) } } fmt.Printf("#%d - #%d: %s\n", from, stats.Blocks[i], content)