Skip to content

Commit

Permalink
transfer-contract: change spend_moonlight
Browse files Browse the repository at this point in the history
Propagate the right error while checking for moonlight nonce
  • Loading branch information
herr-seppia committed Sep 3, 2024
1 parent 056090a commit 40d5aab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/transfer/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,11 @@ impl TransferState {
// transactions. Since this number is so large, we also
// skip overflow checks.
let incremented_nonce = account.nonce + 1;
if moonlight_tx.nonce() != incremented_nonce {
panic!("Invalid nonce");
if moonlight_tx.nonce() < incremented_nonce {
panic!("Already used nonce");
}
if moonlight_tx.nonce() > incremented_nonce {
panic!(execution_core::transfer::PANIC_NONCE_NOT_READY);
}

account.balance -= total_value;
Expand Down

0 comments on commit 40d5aab

Please sign in to comment.