Skip to content

Commit

Permalink
Merge pull request #2299 from dusk-network/fix-stake
Browse files Browse the repository at this point in the history
stake-contract: fix prev_stake for Stake operation
  • Loading branch information
herr-seppia authored Sep 9, 2024
2 parents ec209bd + 8dc7130 commit bb0b836
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/stake/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl StakeState {
panic!("The stake must target the correct chain");
}

let prev_stake = self.get_stake(&account).copied();
let loaded_stake = self.load_or_create_stake_mut(&account);

// ensure the stake is at least the minimum and that there isn't an
Expand Down Expand Up @@ -122,7 +123,7 @@ impl StakeState {
let key = account.to_bytes();
self.previous_block_state
.entry(key)
.or_insert((None, account));
.or_insert((prev_stake, account));
}

pub fn unstake(&mut self, unstake: Withdraw) {
Expand Down

0 comments on commit bb0b836

Please sign in to comment.