Skip to content

Commit

Permalink
improve error handling when refactoring simulation logic for reusability
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolae Leonte <nicolae.leonte.go@gmail.com>
  • Loading branch information
trung and nicolae-leonte-go committed Dec 16, 2020
1 parent 77a89e0 commit 5908486
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ func runSimulation(ctx context.Context, b Backend, from common.Address, tx *type
evm.StateDB.SetNonce(contractAddr, 1)
}
}
return evm, nil
return evm, err
}

// SendTransaction creates a transaction for the given argument, sign it and submit it to the
Expand Down Expand Up @@ -2613,7 +2613,10 @@ func simulateExecutionForPE(ctx context.Context, b Backend, from common.Address,
}

evm, err := runSimulation(ctx, b, from, privateTx)

if evm == nil {
log.Debug("TX Simulation setup failed", "error", err)
return nil, common.Hash{}, err
}
if err != nil {
if privateTxArgs.PrivacyFlag.IsStandardPrivate() {
log.Debug("An error occurred during StandardPrivate transaction simulation. "+
Expand Down

0 comments on commit 5908486

Please sign in to comment.