mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Revert "core/state: add debug if accounts mismatch"
This reverts commit b9339ca847.
This commit is contained in:
parent
b9339ca847
commit
47fc9684a8
1 changed files with 0 additions and 52 deletions
|
|
@ -24,7 +24,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/tracing"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/triedb"
|
||||
"github.com/ethereum/go-ethereum/triedb/pathdb"
|
||||
"github.com/holiman/uint256"
|
||||
|
|
@ -120,57 +119,6 @@ func TestSizeTracker(t *testing.T) {
|
|||
}
|
||||
baseline := baselineResult.stat
|
||||
|
||||
// DEBUG: Check if baseline found all expected accounts
|
||||
if baseline.Accounts != 52 {
|
||||
t.Logf("WARNING: Baseline found %d accounts instead of expected 52", baseline.Accounts)
|
||||
|
||||
// Collect all expected account addresses
|
||||
expectedAddrs := make(map[common.Address]bool)
|
||||
expectedAddrs[addr1] = true
|
||||
expectedAddrs[addr2] = true
|
||||
expectedAddrs[addr3] = true
|
||||
for i := 1; i < 50; i++ {
|
||||
testAddr := common.BigToAddress(uint256.NewInt(uint64(i + 100)).ToBig())
|
||||
expectedAddrs[testAddr] = true
|
||||
}
|
||||
|
||||
// Scan what's actually in the snapshot
|
||||
actualAddrs := make(map[common.Address]bool)
|
||||
iter := db.NewIterator(rawdb.SnapshotAccountPrefix, nil)
|
||||
for iter.Next() {
|
||||
// Key is: prefix + account hash
|
||||
if len(iter.Key()) < len(rawdb.SnapshotAccountPrefix)+common.HashLength {
|
||||
continue
|
||||
}
|
||||
accHash := common.BytesToHash(iter.Key()[len(rawdb.SnapshotAccountPrefix):])
|
||||
|
||||
// Find which address this hash corresponds to
|
||||
for addr := range expectedAddrs {
|
||||
if crypto.Keccak256Hash(addr.Bytes()) == accHash {
|
||||
actualAddrs[addr] = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
iter.Release()
|
||||
|
||||
t.Logf("Serial scan found %d accounts in snapshot", len(actualAddrs))
|
||||
|
||||
// Find missing accounts
|
||||
for addr := range expectedAddrs {
|
||||
if !actualAddrs[addr] {
|
||||
t.Logf("MISSING ACCOUNT: %s (hash: %s)", addr.Hex(), crypto.Keccak256Hash(addr.Bytes()).Hex())
|
||||
}
|
||||
}
|
||||
|
||||
// Find unexpected accounts
|
||||
for addr := range actualAddrs {
|
||||
if !expectedAddrs[addr] {
|
||||
t.Logf("UNEXPECTED ACCOUNT: %s (hash: %s)", addr.Hex(), crypto.Keccak256Hash(addr.Bytes()).Hex())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now start the tracker and notify it of updates that happen AFTER the baseline
|
||||
tracker, err := NewSizeTracker(db, tdb)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue