@@ -1475,6 +1475,38 @@ func (s *StateDB) handleDestruction(nodes *trienode.MergedNodeSet) (map[common.A
14751475 return incomplete , nil
14761476}
14771477
1478+ func (s * StateDB ) DebugPrint (block uint64 , deleteEmptyObjects bool ) {
1479+ log .Info ("================== block start ===============" , "number" , block )
1480+ hash := s .IntermediateRoot (deleteEmptyObjects )
1481+ log .Info ("mpt root" , "hash" , hash )
1482+ for addr := range s .stateObjectsDirty {
1483+ if obj := s .stateObjects [addr ]; ! obj .deleted {
1484+ log .Info ("state object" , "address" , obj .address )
1485+ log .Info ("state object" , "addrHash" , obj .addrHash )
1486+ log .Info ("state object" , "dirtyCode" , obj .dirtyCode )
1487+ log .Info ("state object" , "selfDestructed" , obj .selfDestructed )
1488+ log .Info ("state object" , "deleted" , obj .deleted )
1489+ log .Info ("state object" , "created" , obj .created )
1490+ if obj .origin != nil {
1491+ log .Info ("state object origin" , "Nonce" , obj .origin .Nonce )
1492+ log .Info ("state object origin" , "Balance" , obj .origin .Balance )
1493+ log .Info ("state object origin" , "Root" , obj .origin .Root )
1494+ log .Info ("state object origin" , "CodeHash" , common .Bytes2Hex (obj .origin .CodeHash ))
1495+ } else {
1496+ log .Info ("state object origin is nil" )
1497+ }
1498+ log .Info ("state object new" , "Nonce" , obj .data .Nonce )
1499+ log .Info ("state object new" , "Balance" , obj .data .Balance )
1500+ log .Info ("state object new" , "Root" , obj .data .Root )
1501+ log .Info ("state object new" , "CodeHash" , common .Bytes2Hex (obj .data .CodeHash ))
1502+ }
1503+ }
1504+ log .Info ("================== block end ================" , "number" , block )
1505+ if block == 1 {
1506+ log .Crit ("exit...." )
1507+ }
1508+ }
1509+
14781510// Once the state is committed, tries cached in stateDB (including account
14791511// trie, storage tries) will no longer be functional. A new state instance
14801512// must be created with new root and updated database for accessing post-
0 commit comments