Skip to content

Commit

Permalink
test: fix test, collators must be active/rewarded to be eligible for …
Browse files Browse the repository at this point in the history
…redeposit

Signed-off-by: Adam Reif <[email protected]>
  • Loading branch information
Adam Reif authored and Adam Reif committed Jul 13, 2023
1 parent 96237c4 commit 052c2a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pallets/pallet-lottery/src/staking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl<T: Config> Pallet<T> {
new_deposit
);
if new_deposit < <T as pallet_parachain_staking::Config>::MinDelegation::get() {
log::trace!(function_name!());
log::debug!(
"Leftover unstaking funds of {:?} below limit for restaking of {:?}. Keeping in pallet",
new_deposit,
Self::min_deposit(),
);
return vec![];
}
let mut deposits: Vec<(T::AccountId, BalanceOf<T>)> = vec![];
Expand Down
4 changes: 4 additions & 0 deletions pallets/pallet-lottery/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,9 +637,13 @@ fn multiround_withdraw_partial_deposit_works2() {
quarter_balance
));
roll_to_round_begin(3);
pallet_parachain_staking::AwardedPts::<Test>::insert(3, *BOB, 20);
pallet_parachain_staking::AwardedPts::<Test>::insert(3, *CHARLIE, 20);
assert_ok!(Lottery::draw_lottery(RawOrigin::Root.into()));
assert_eq!(2, Lottery::withdrawal_request_queue().len());
roll_to_round_begin(4);
pallet_parachain_staking::AwardedPts::<Test>::insert(4, *BOB, 20);
pallet_parachain_staking::AwardedPts::<Test>::insert(4, *CHARLIE, 20);
assert_ok!(Lottery::draw_lottery(RawOrigin::Root.into()));
assert_eq!(0, Lottery::unlocked_unstaking_funds());
assert!(Lottery::withdrawal_request_queue().is_empty());
Expand Down

0 comments on commit 052c2a3

Please sign in to comment.