Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Revert state changes if precompile execution fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalinin committed Aug 28, 2017
1 parent f82d16a commit cedfc93
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1176,15 +1176,15 @@ public void callToPrecompiledAddress(MessageCall msg, PrecompiledContract contra
if (out.getLeft()) { // success
this.refundGas(msg.getGas().longValue() - requiredGas, "call pre-compiled");
this.stackPushOne();
track.commit();
} else {
// spend all gas on failure and push zero
// spend all gas on failure, push zero and revert state changes
this.refundGas(0, "call pre-compiled");
this.stackPushZero();
track.rollback();
}

this.memorySave(msg.getOutDataOffs().intValue(), out.getRight());

track.commit();
}
}

Expand Down

0 comments on commit cedfc93

Please sign in to comment.