@@ -329,7 +329,12 @@ func (sdb *IntraBlockState) SubRefund(gas uint64) error {
329329
330330// Exist reports whether the given account address exists in the state.
331331// Notably this also returns true for suicided accounts.
332- func (sdb * IntraBlockState ) Exist (addr common.Address ) (bool , error ) {
332+ func (sdb * IntraBlockState ) Exist (addr common.Address ) (exists bool , err error ) {
333+ if dbg .TraceTransactionIO && (sdb .trace || traceAccount (addr )) {
334+ defer func () {
335+ fmt .Printf ("%d (%d.%d) Exists %x: %v (%s)\n " , sdb .blockNum , sdb .txIndex , sdb .version , addr , exists , dbg .Stack ())
336+ }()
337+ }
333338 s , err := sdb .getStateObject (addr )
334339 if err != nil {
335340 return false , err
@@ -339,7 +344,12 @@ func (sdb *IntraBlockState) Exist(addr common.Address) (bool, error) {
339344
340345// Empty returns whether the state object is either non-existent
341346// or empty according to the EIP161 specification (balance = nonce = code = 0)
342- func (sdb * IntraBlockState ) Empty (addr common.Address ) (bool , error ) {
347+ func (sdb * IntraBlockState ) Empty (addr common.Address ) (empty bool , err error ) {
348+ if dbg .TraceTransactionIO && (sdb .trace || traceAccount (addr )) {
349+ defer func () {
350+ fmt .Printf ("%d (%d.%d) Empty %x: %v\n " , sdb .blockNum , sdb .txIndex , sdb .version , addr , empty )
351+ }()
352+ }
343353 so , err := sdb .getStateObject (addr )
344354 if err != nil {
345355 return false , err
@@ -1139,9 +1149,29 @@ func (sdb *IntraBlockState) createObject(addr common.Address, previous *stateObj
11391149// 2. tx_create(sha(account ++ nonce)) (note that this gets the address of 1)
11401150//
11411151// Carrying over the balance ensures that Ether doesn't disappear.
1142- func (sdb * IntraBlockState ) CreateAccount (addr common.Address , contractCreation bool ) error {
1152+ func (sdb * IntraBlockState ) CreateAccount (addr common.Address , contractCreation bool ) ( err error ) {
11431153 var prevInc uint64
1144- previous , err := sdb .getStateObject (addr )
1154+ var previous * stateObject
1155+
1156+ if dbg .TraceTransactionIO && (sdb .trace || traceAccount (addr )) {
1157+ defer func () {
1158+ var creatingContract string
1159+ if contractCreation {
1160+ creatingContract = " (contract)"
1161+ }
1162+ if err != nil {
1163+ fmt .Printf ("%d (%d.%d) Create Account%s: %x, err=%s\n " , sdb .blockNum , sdb .txIndex , sdb .version , creatingContract , addr , err )
1164+ } else {
1165+ var bal uint256.Int
1166+ if previous != nil {
1167+ bal = previous .data .Balance
1168+ }
1169+ fmt .Printf ("%d (%d.%d) Create Account%s: %x, balance=%d\n " , sdb .blockNum , sdb .txIndex , sdb .version , creatingContract , addr , & bal )
1170+ }
1171+ }()
1172+ }
1173+
1174+ previous , err = sdb .getStateObject (addr )
11451175 if err != nil {
11461176 return err
11471177 }
@@ -1233,7 +1263,7 @@ func (sdb *IntraBlockState) RevertToSnapshot(revid int, err error) {
12331263 }
12341264 }
12351265
1236- if traced && sdb . txIndex == 8 && sdb . version == 1 {
1266+ if traced {
12371267 fmt .Printf ("%d (%d.%d) Reverted: %d:%d\n " , sdb .blockNum , sdb .txIndex , sdb .version , revid , snapshot )
12381268 }
12391269}
0 commit comments