Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed Oct 9, 2023
1 parent 68a1240 commit 0373dbb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pallets/creditcoin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,17 @@ pub mod pallet {
let StorageCleanupState { ask_orders, bid_orders, offers } = current;
log::debug!("ask orders block: {:?}, cursor: {}; bid orders block: {:?}, cursor: {}; offers block: {:?}, cursor: {}",
ask_orders.on_block,ask_orders.cursor.is_some(), bid_orders.on_block, bid_orders.cursor.is_some(),offers.on_block, offers.cursor.is_some(),);
let ask_cleanup = (ask_orders.on_block <= block_number).then(|| {
let ask_cleanup = AskOrders::<T>::clear_prefix(
ask_orders.on_block,
limit.saturating_sub(total_count),
ask_orders.cursor(),
);
ask_count = ask_count.saturating_add(ask_cleanup.backend);
total_count = total_count.saturating_add(ask_cleanup.backend);
ask_cleanup
});
let ask_cleanup = (ask_orders.on_block <= block_number && total_count < limit)
.then(|| {
let ask_cleanup = AskOrders::<T>::clear_prefix(
ask_orders.on_block,
limit.saturating_sub(total_count),
ask_orders.cursor(),
);
ask_count = ask_count.saturating_add(ask_cleanup.backend);
total_count = total_count.saturating_add(ask_cleanup.backend);
ask_cleanup
});

let bid_cleanup = (bid_orders.on_block <= block_number && total_count < limit)
.then(|| {
Expand Down

0 comments on commit 0373dbb

Please sign in to comment.