mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 02:11:07 +00:00
Fix fast-unstake for accounts with slashing (#12963)
* Fix fast-unstake for accounts with slashing * ".git/.scripts/fmt.sh" 1 * fmt * fix * fix weight tracking * Adds tests for withdraw_unbonded with slashing * Removes tests for withdraw_unbonded with slashing * ".git/.scripts/fmt.sh" * Adds slash spans calculation test for withdraw_unbonded Co-authored-by: command-bot <> Co-authored-by: gpestana <g6pestana@gmail.com>
This commit is contained in:
@@ -1569,7 +1569,7 @@ impl<T: Config> StakingInterface for Pallet<T> {
|
||||
}
|
||||
|
||||
fn force_unstake(who: Self::AccountId) -> sp_runtime::DispatchResult {
|
||||
let num_slashing_spans = Self::slashing_spans(&who).iter().count() as u32;
|
||||
let num_slashing_spans = Self::slashing_spans(&who).map_or(0, |s| s.iter().count() as u32);
|
||||
Self::force_unstake(RawOrigin::Root.into(), who.clone(), num_slashing_spans)
|
||||
}
|
||||
|
||||
|
||||
@@ -982,7 +982,8 @@ pub mod pallet {
|
||||
// `BondingDuration` to proceed with the unbonding.
|
||||
let maybe_withdraw_weight = {
|
||||
if unlocking == T::MaxUnlockingChunks::get() as usize {
|
||||
let real_num_slashing_spans = Self::slashing_spans(&controller).iter().count();
|
||||
let real_num_slashing_spans =
|
||||
Self::slashing_spans(&controller).map_or(0, |s| s.iter().count());
|
||||
Some(Self::do_withdraw_unbonded(&controller, real_num_slashing_spans as u32)?)
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user