Skip to content

Commit

Permalink
fix: optimize pending deposits strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyr committed Nov 29, 2021
1 parent bd036ed commit 3da5441
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/mem-pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,9 +931,13 @@ impl MemPool {
let state_db = self.fetch_state_db(db)?;
let state = state_db.state_tree()?;
let mem_account_count = state.get_account_count()?;
let tip_account_count: u32 = self.mem_block.prev_merkle_state().count().unpack();
let safe_expired =
self.pending_deposits.is_empty() && mem_account_count == tip_account_count;
let tip_account_count: u32 = {
let new_tip_block = db
.get_block(&new_block_hash)?
.ok_or_else(|| anyhow!("can't find new tip block"))?;
new_tip_block.raw().post_account().count().unpack()
};
let safe_expired = mem_account_count == tip_account_count;
if safe_expired || force_expired {
if safe_expired {
log::debug!(
Expand Down

0 comments on commit 3da5441

Please sign in to comment.