chore: add state obj debug info
This commit is contained in:
parent
3a70b35ea2
commit
412c5ee791
@ -1670,6 +1670,9 @@ func (p *Parlia) getCurrentValidators(blockHash common.Hash, blockNum *big.Int)
|
||||
// distributeIncoming distributes system incoming of the block
|
||||
func (p *Parlia) distributeIncoming(val common.Address, state *state.StateDB, header *types.Header, chain core.ChainContext,
|
||||
txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool) error {
|
||||
|
||||
state.DebugPrint(header.Number.Uint64(), true)
|
||||
|
||||
coinbase := header.Coinbase
|
||||
balance := state.GetBalance(consensus.SystemAddress)
|
||||
if balance.Cmp(common.U2560) <= 0 {
|
||||
|
@ -1497,7 +1497,7 @@ func (s *StateDB) handleDestruction(nodes *trienode.MergedNodeSet) (map[common.A
|
||||
}
|
||||
|
||||
func (s *StateDB) DebugPrint(block uint64, deleteEmptyObjects bool) {
|
||||
if block != 363 {
|
||||
if block != 1084 {
|
||||
return
|
||||
}
|
||||
log.Info("================== block start ===============", "number", block)
|
||||
@ -1515,6 +1515,7 @@ func (s *StateDB) DebugPrint(block uint64, deleteEmptyObjects bool) {
|
||||
})
|
||||
|
||||
for _, addr := range addrs {
|
||||
log.Info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
|
||||
if obj := s.stateObjects[addr]; !obj.deleted {
|
||||
log.Info("state object", "address", obj.address)
|
||||
log.Info("state object", "addrHash", obj.addrHash)
|
||||
@ -1534,7 +1535,40 @@ func (s *StateDB) DebugPrint(block uint64, deleteEmptyObjects bool) {
|
||||
log.Info("state object new", "Balance", obj.data.Balance)
|
||||
log.Info("state object new", "Root", obj.data.Root)
|
||||
log.Info("state object new", "CodeHash", common.Bytes2Hex(obj.data.CodeHash))
|
||||
log.Info("-------------------------------------------")
|
||||
log.Info("...........................................`")
|
||||
keys := make([]common.Hash, 0)
|
||||
for key := range obj.originStorage {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.SliceStable(keys, func(i, j int) bool {
|
||||
return keys[i].Cmp(keys[j]) < 0
|
||||
})
|
||||
for _, k := range keys {
|
||||
log.Info("originStorage,", "key: ", k.String(), "val: ", obj.originStorage[k].String())
|
||||
}
|
||||
log.Info("...........................................")
|
||||
keys = make([]common.Hash, 0)
|
||||
for key := range obj.pendingStorage {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.SliceStable(keys, func(i, j int) bool {
|
||||
return keys[i].Cmp(keys[j]) < 0
|
||||
})
|
||||
for _, k := range keys {
|
||||
log.Info("originStorage,", "key: ", k.String(), "val: ", obj.pendingStorage[k].String())
|
||||
}
|
||||
log.Info("...........................................")
|
||||
keys = make([]common.Hash, 0)
|
||||
for key := range obj.dirtyStorage {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.SliceStable(keys, func(i, j int) bool {
|
||||
return keys[i].Cmp(keys[j]) < 0
|
||||
})
|
||||
for _, k := range keys {
|
||||
log.Info("originStorage,", "key: ", k.String(), "val: ", obj.dirtyStorage[k].String())
|
||||
}
|
||||
log.Info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
|
||||
}
|
||||
}
|
||||
log.Info("================== block end ================", "number", block)
|
||||
|
Loading…
Reference in New Issue
Block a user