Skip to content

Commit

Permalink
chore: add safety check when update ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
mclyk committed Nov 15, 2023
1 parent 615c655 commit 315776c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pallets/liquid-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,14 +936,13 @@ pub mod pallet {

Self::do_update_ledger(derivative_index, |ledger| {
ensure!(
!Self::is_updated(derivative_index),
!Self::is_updated(derivative_index)
&& XcmRequests::<T>::iter().count().is_zero(),
Error::<T>::StakingLedgerLocked
);
let requests = XcmRequests::<T>::iter().count();
if staking_ledger.total < ledger.total
|| staking_ledger.active < ledger.active
|| staking_ledger.unlocking != ledger.unlocking
|| !requests.is_zero()
{
log::trace!(
target: "liquidStaking::set_staking_ledger::invalidStakingLedger",
Expand Down

0 comments on commit 315776c

Please sign in to comment.