Skip to content

Commit ba489d9

Browse files
authored
Merge pull request #320 from input-output-hk/prc/319-no-stake-reward-refunds
Don't pay stake refunds to rewards
2 parents 62dbe73 + 318b6af commit ba489d9

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

modules/accounts_state/src/state.rs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ pub struct State {
116116
/// Pool refunds to apply next epoch (list of reward accounts to refund to)
117117
pool_refunds: Vec<StakeAddress>,
118118

119-
/// Stake address refunds to apply next epoch
120-
stake_refunds: Vec<(StakeAddress, Lovelace)>,
121-
122119
/// MIRs to pay next epoch
123120
mirs: Vec<MoveInstantaneousReward>,
124121

@@ -324,7 +321,6 @@ impl State {
324321

325322
// Pay the refunds after snapshot, so they don't appear in active_stake
326323
reward_deltas.extend(self.pay_pool_refunds());
327-
reward_deltas.extend(self.pay_stake_refunds());
328324

329325
// Verify pots state
330326
verifier.verify_pots(epoch, &self.pots);
@@ -496,33 +492,6 @@ impl State {
496492
reward_deltas
497493
}
498494

499-
/// Pay stake address refunds
500-
fn pay_stake_refunds(&mut self) -> Vec<StakeRewardDelta> {
501-
let mut reward_deltas = Vec::<StakeRewardDelta>::new();
502-
503-
let refunds = take(&mut self.stake_refunds);
504-
if !refunds.is_empty() {
505-
info!(
506-
"{} deregistered stake addresses, total refunds {}",
507-
refunds.len(),
508-
refunds.iter().map(|(_, n)| n).sum::<Lovelace>()
509-
);
510-
}
511-
512-
// Send them their deposits back
513-
for (stake_address, deposit) in refunds {
514-
let mut stake_addresses = self.stake_addresses.lock().unwrap();
515-
reward_deltas.push(StakeRewardDelta {
516-
stake_address: stake_address.clone(), // Extract hash for delta
517-
delta: deposit as i64,
518-
});
519-
stake_addresses.add_to_reward(&stake_address, deposit);
520-
self.pots.deposits -= deposit;
521-
}
522-
523-
reward_deltas
524-
}
525-
526495
/// Pay MIRs
527496
fn pay_mirs(&mut self) -> Vec<StakeRewardDelta> {
528497
let mut reward_deltas = Vec::<StakeRewardDelta>::new();
@@ -841,8 +810,7 @@ impl State {
841810
}
842811
};
843812

844-
// Schedule refund
845-
self.stake_refunds.push((stake_address.clone(), deposit));
813+
self.pots.deposits -= deposit;
846814

847815
// Add to registration changes
848816
self.current_epoch_registration_changes.lock().unwrap().push(RegistrationChange {

0 commit comments

Comments
 (0)