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 b08e899 commit 424aba2
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 @@ -190,8 +190,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 @@ -207,7 +207,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 424aba2

Please sign in to comment.