git.delta.rocks / unique-network / refs/commits / 0889383aee24

difftreelog

fix unstake

PraetorP2022-09-01parent: #7f0477c.patch.diff
in: master

1 file changed

modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
210 // consumed_weight += weight;210 // consumed_weight += weight;
211 // };211 // };
212212
213 let current_relay_block = T::RelayBlockNumberProvider::current_block_number();
213 PendingUnstake::<T>::iter()214 PendingUnstake::<T>::iter()
214 .filter_map(|((staker, block), amount)| {215 .filter_map(|((staker, block), amount)| {
215 if block <= current_block {216 if block <= current_relay_block {
216 Some((staker, block, amount))217 Some((staker, block, amount))
217 } else {218 } else {
218 None219 None
219 }220 }
220 })221 })
221 .for_each(|(staker, block, amount)| {222 .for_each(|(staker, block, amount)| {
222 Self::unlock_balance_unchecked(&staker, amount); // TO-DO : Replace with a method that will check that the unstack is less than it was blocked, otherwise take the delta from the treasuries223 Self::unlock_balance_unchecked(&staker, amount);
223 <PendingUnstake<T>>::remove((staker, block));224 <PendingUnstake<T>>::remove((staker, block));
224 });225 });
225226