mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-18 09:00:44 +00:00
core/rawdb: enforce exact key length for num->hash and td in db inspect (#34000)
This PR improves `db inspect` classification accuracy in `core/rawdb/database.go` by tightening key-shape checks for: - `Block number->hash` - `Difficulties (deprecated)` Previously, both categories used prefix/suffix heuristics and could mis-bucket unrelated entries.
This commit is contained in:
parent
1c9ddee16f
commit
eaa9418ac1
1 changed files with 2 additions and 2 deletions
|
|
@ -478,9 +478,9 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
|
|||
bodies.add(size)
|
||||
case bytes.HasPrefix(key, blockReceiptsPrefix) && len(key) == (len(blockReceiptsPrefix)+8+common.HashLength):
|
||||
receipts.add(size)
|
||||
case bytes.HasPrefix(key, headerPrefix) && bytes.HasSuffix(key, headerTDSuffix):
|
||||
case bytes.HasPrefix(key, headerPrefix) && bytes.HasSuffix(key, headerTDSuffix) && len(key) == (len(headerPrefix)+8+common.HashLength+len(headerTDSuffix)):
|
||||
tds.add(size)
|
||||
case bytes.HasPrefix(key, headerPrefix) && bytes.HasSuffix(key, headerHashSuffix):
|
||||
case bytes.HasPrefix(key, headerPrefix) && bytes.HasSuffix(key, headerHashSuffix) && len(key) == (len(headerPrefix)+8+common.HashLength+len(headerHashSuffix)):
|
||||
numHashPairings.add(size)
|
||||
case bytes.HasPrefix(key, headerNumberPrefix) && len(key) == (len(headerNumberPrefix)+common.HashLength):
|
||||
hashNumPairings.add(size)
|
||||
|
|
|
|||
Loading…
Reference in a new issue