diff --git a/sequencer/finalizer.go b/sequencer/finalizer.go index 813ba3e5e6..3b134576f0 100644 --- a/sequencer/finalizer.go +++ b/sequencer/finalizer.go @@ -737,6 +737,35 @@ func (f *finalizer) updateWorkerAfterSuccessfulProcessing(ctx context.Context, t log.Debugf("tx %s deleted from address %s", txHash.String(), txFrom.Hex()) } + // XLayer handle + _, found := result.ReadWriteAddresses[txFrom] + exist := result.BlockResponses != nil && len(result.BlockResponses) > 0 && result.BlockResponses[0].TransactionResponses != nil && len(result.BlockResponses[0].TransactionResponses) > 0 + if found && exist { + txResponse := result.BlockResponses[0].TransactionResponses[0] + if executor.IsROMOutOfGasError(executor.RomErrorCode(txResponse.RomError)) { + // get latest balance and nonce. + root, err := f.stateIntf.GetLastStateRoot(ctx, nil) + if err != nil { + log.Error(err) + } + + //nonce, err := f.stateIntf.GetNonceByStateRoot(ctx, txFrom, root) + //if err != nil { + // log.Error(err) + //} + balance, err := f.stateIntf.GetBalanceByStateRoot(ctx, txFrom, root) + if err != nil { + log.Error(err) + } + + log.Infof("updateWorkerAfterSuccessfulProcessing oog error: address:%v, balance:%v, ", txFrom.Hex(), balance.String()) + + //var num uint64 = nonce.Uint64() + //result.ReadWriteAddresses[txFrom].Nonce = &num + result.ReadWriteAddresses[txFrom].Balance = balance + } + } + txsToDelete := f.workerIntf.UpdateAfterSingleSuccessfulTxExecution(txFrom, result.ReadWriteAddresses) for _, txToDelete := range txsToDelete { err := f.poolIntf.UpdateTxStatus(ctx, txToDelete.Hash, pool.TxStatusFailed, false, txToDelete.FailedReason)