mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
fix
This commit is contained in:
parent
0b13632ae2
commit
1abfb07782
3 changed files with 17 additions and 17 deletions
|
|
@ -535,7 +535,7 @@ func (t *SizeTracker) iterateTable(closed chan struct{}, prefix []byte, name str
|
||||||
iter := t.db.NewIterator(prefix, nil)
|
iter := t.db.NewIterator(prefix, nil)
|
||||||
defer iter.Release()
|
defer iter.Release()
|
||||||
|
|
||||||
log.Info("Iterating state", "category", name)
|
log.Debug("Iterating state", "category", name)
|
||||||
for iter.Next() {
|
for iter.Next() {
|
||||||
count++
|
count++
|
||||||
bytes += int64(len(iter.Key()) + len(iter.Value()))
|
bytes += int64(len(iter.Key()) + len(iter.Value()))
|
||||||
|
|
@ -557,7 +557,7 @@ func (t *SizeTracker) iterateTable(closed chan struct{}, prefix []byte, name str
|
||||||
log.Error("Iterator error", "category", name, "err", err)
|
log.Error("Iterator error", "category", name, "err", err)
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
log.Info("Finished state iteration", "category", name, "count", count, "size", common.StorageSize(bytes), "elapsed", common.PrettyDuration(time.Since(start)))
|
log.Debug("Finished state iteration", "category", name, "count", count, "size", common.StorageSize(bytes), "elapsed", common.PrettyDuration(time.Since(start)))
|
||||||
return count, bytes, nil
|
return count, bytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ func TestSizeTracker(t *testing.T) {
|
||||||
|
|
||||||
state.AddBalance(addr2, uint256.NewInt(2000), tracing.BalanceChangeUnspecified)
|
state.AddBalance(addr2, uint256.NewInt(2000), tracing.BalanceChangeUnspecified)
|
||||||
state.SetNonce(addr2, 2, tracing.NonceChangeUnspecified)
|
state.SetNonce(addr2, 2, tracing.NonceChangeUnspecified)
|
||||||
state.SetCode(addr2, []byte{0x60, 0x80, 0x60, 0x40, 0x52})
|
state.SetCode(addr2, []byte{0x60, 0x80, 0x60, 0x40, 0x52}, tracing.CodeChangeUnspecified)
|
||||||
|
|
||||||
state.AddBalance(addr3, uint256.NewInt(3000), tracing.BalanceChangeUnspecified)
|
state.AddBalance(addr3, uint256.NewInt(3000), tracing.BalanceChangeUnspecified)
|
||||||
state.SetNonce(addr3, 3, tracing.NonceChangeUnspecified)
|
state.SetNonce(addr3, 3, tracing.NonceChangeUnspecified)
|
||||||
|
|
@ -92,7 +92,7 @@ func TestSizeTracker(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if i%3 == 0 {
|
if i%3 == 0 {
|
||||||
newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52})
|
newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}, tracing.CodeChangeUnspecified)
|
||||||
}
|
}
|
||||||
|
|
||||||
root, _, err := newState.CommitWithUpdate(blockNum, true, false)
|
root, _, err := newState.CommitWithUpdate(blockNum, true, false)
|
||||||
|
|
@ -160,7 +160,7 @@ func TestSizeTracker(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if i%3 == 0 {
|
if i%3 == 0 {
|
||||||
newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52})
|
newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}, tracing.CodeChangeUnspecified)
|
||||||
}
|
}
|
||||||
|
|
||||||
root, update, err := newState.CommitWithUpdate(blockNum, true, false)
|
root, update, err := newState.CommitWithUpdate(blockNum, true, false)
|
||||||
|
|
|
||||||
|
|
@ -458,17 +458,17 @@ func (api *DebugAPI) StateSize() (interface{}, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"stateRoot": stats.StateRoot,
|
"stateRoot": stats.StateRoot,
|
||||||
"blockNumber": hexutil.Uint64(stats.BlockNumber),
|
"blockNumber": hexutil.Uint64(stats.BlockNumber),
|
||||||
"accounts": hexutil.Uint64(stats.Accounts),
|
"accounts": hexutil.Uint64(stats.Accounts),
|
||||||
"accountBytes": hexutil.Uint64(stats.AccountBytes),
|
"accountBytes": hexutil.Uint64(stats.AccountBytes),
|
||||||
"storages": hexutil.Uint64(stats.Storages),
|
"storages": hexutil.Uint64(stats.Storages),
|
||||||
"storageBytes": hexutil.Uint64(stats.StorageBytes),
|
"storageBytes": hexutil.Uint64(stats.StorageBytes),
|
||||||
"accountTrienodes": hexutil.Uint64(stats.AccountTrienodes),
|
"accountTrienodes": hexutil.Uint64(stats.AccountTrienodes),
|
||||||
"accountTrienodeBytes": hexutil.Uint64(stats.AccountTrienodeBytes),
|
"accountTrienodeBytes": hexutil.Uint64(stats.AccountTrienodeBytes),
|
||||||
"storageTrienodes": hexutil.Uint64(stats.StorageTrienodes),
|
"storageTrienodes": hexutil.Uint64(stats.StorageTrienodes),
|
||||||
"storageTrienodeBytes": hexutil.Uint64(stats.StorageTrienodeBytes),
|
"storageTrienodeBytes": hexutil.Uint64(stats.StorageTrienodeBytes),
|
||||||
"contractCodes": hexutil.Uint64(stats.ContractCodes),
|
"contractCodes": hexutil.Uint64(stats.ContractCodes),
|
||||||
"contractCodeBytes": hexutil.Uint64(stats.ContractCodeBytes),
|
"contractCodeBytes": hexutil.Uint64(stats.ContractCodeBytes),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue