From 0889383aee24bdc9189b92a67486887f036e09be Mon Sep 17 00:00:00 2001 From: PraetorP Date: Thu, 01 Sep 2022 05:45:08 +0000 Subject: [PATCH] fix unstake --- --- a/pallets/app-promotion/src/lib.rs +++ b/pallets/app-promotion/src/lib.rs @@ -209,17 +209,18 @@ // consumed_weight += T::DbWeight::get().reads_writes(reads, writes); // consumed_weight += weight; // }; - + + let current_relay_block = T::RelayBlockNumberProvider::current_block_number(); PendingUnstake::::iter() .filter_map(|((staker, block), amount)| { - if block <= current_block { + if block <= current_relay_block { Some((staker, block, amount)) } else { None } }) .for_each(|(staker, block, amount)| { - 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 treasuries + Self::unlock_balance_unchecked(&staker, amount); >::remove((staker, block)); }); -- gitstuff