Skip to content

Commit

Permalink
stake-contract: allow partial reward withdrawal
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Aug 31, 2024
1 parent 7a5f2f6 commit f665423
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/stake/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ impl StakeState {
panic!("There is no reward available to withdraw");
}

if value != loaded_stake.reward {
panic!("Value withdrawn different from available reward");
if value > loaded_stake.reward {
panic!("Value withdrawn higher than available reward");
}

// check signature is correct
Expand All @@ -211,7 +211,7 @@ impl StakeState {
.expect("Withdrawing reward should succeed");

// update the state accordingly
loaded_stake.reward = 0;
loaded_stake.reward -= value;
rusk_abi::emit(
"withdraw",
StakeWithReceiverEvent {
Expand Down

0 comments on commit f665423

Please sign in to comment.