Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Fix Test
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed May 4, 2022
1 parent 676a0c7 commit 25a4b46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frame/balances/src/lib.rs
Expand Up @@ -1004,7 +1004,7 @@ pub mod pallet {
for lock in Self::locks(who.borrow()).iter() {
let locked_amount = match &lock.lock_for {
LockFor::Common { amount } => *amount,
LockFor::Staking(staking_lock) => staking_lock.locked_amount(),
LockFor::Staking(staking_lock) => staking_lock.staking_amount + staking_lock.total_unbond(),
};
if lock.reasons == Reasons::All || lock.reasons == Reasons::Misc {
frozen_balance.misc = frozen_balance.misc.max(locked_amount);
Expand Down
9 changes: 8 additions & 1 deletion frame/staking/src/substrate_tests.rs
Expand Up @@ -2010,7 +2010,14 @@ fn bond_with_no_staked_value() {
RewardDestination::Controller,
0,
));
assert_eq!(Ring::locks(&1)[0].locked_amount(), 5);
assert_eq!(
if let LockFor::Common { amount } = &Ring::locks(&1)[0].lock_for {
*amount
} else {
unreachable!();
},
5
);

// unbonding even 1 will cause all to be unbonded.
assert_ok!(Staking::unbond(Origin::signed(2), StakingBalance::RingBalance(1)));
Expand Down

0 comments on commit 25a4b46

Please sign in to comment.