@@ -440,20 +440,23 @@ func (stateDB *StateDBAdapter) Suicide(evmAddr common.Address) bool {
440
440
stateDB .logError (err )
441
441
return false
442
442
}
443
- // before calling Suicide, EVM will transfer the contract's balance to beneficiary
444
- // need to create a transaction log on successful suicide
445
- if stateDB .lastAddBalanceAmount .Cmp (actBalance ) == 0 {
446
- if stateDB .lastAddBalanceAmount .Cmp (big .NewInt (0 )) > 0 {
447
- from , _ := address .FromBytes (evmAddr [:])
448
- stateDB .addTransactionLogs (& action.TransactionLog {
449
- Type : iotextypes .TransactionLogType_IN_CONTRACT_TRANSFER ,
450
- Sender : from .String (),
451
- Recipient : stateDB .lastAddBalanceAddr ,
452
- Amount : stateDB .lastAddBalanceAmount ,
453
- })
454
- }
455
- } else {
456
- if stateDB .suicideTxLogMismatchPanic {
443
+ // To ensure data consistency, generate this log after the hard-fork
444
+ // a separate patch file will be created later to provide missing logs before the hard-fork
445
+ // TODO: remove this gating once the hard-fork has passed
446
+ if stateDB .suicideTxLogMismatchPanic {
447
+ // before calling Suicide, EVM will transfer the contract's balance to beneficiary
448
+ // need to create a transaction log on successful suicide
449
+ if stateDB .lastAddBalanceAmount .Cmp (actBalance ) == 0 {
450
+ if stateDB .lastAddBalanceAmount .Cmp (big .NewInt (0 )) > 0 {
451
+ from , _ := address .FromBytes (evmAddr [:])
452
+ stateDB .addTransactionLogs (& action.TransactionLog {
453
+ Type : iotextypes .TransactionLogType_IN_CONTRACT_TRANSFER ,
454
+ Sender : from .String (),
455
+ Recipient : stateDB .lastAddBalanceAddr ,
456
+ Amount : stateDB .lastAddBalanceAmount ,
457
+ })
458
+ }
459
+ } else {
457
460
log .L ().Panic ("suicide contract's balance does not match" ,
458
461
zap .String ("suicide" , actBalance .String ()),
459
462
zap .String ("beneficiary" , stateDB .lastAddBalanceAmount .String ()))
0 commit comments