Skip to content

Commit

Permalink
fix(pool): fix crash when block height goes backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Jun 28, 2024
1 parent 3f36456 commit 9a84f6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions crates/builder/src/transaction_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ where
self.validate_transaction(&tx)?;
let gas_fees = GasFees::from(&tx);
info!(
"Sending transaction with nonce: {:?} gas fees: {:?}",
self.nonce, gas_fees
"Sending transaction with nonce: {:?} gas fees: {:?} gas limit: {:?}",
self.nonce,
gas_fees,
tx.gas()
);
let sent_tx = self.sender.send_transaction(tx, expected_storage).await;

Expand Down
4 changes: 2 additions & 2 deletions crates/pool/src/mempool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ impl PoolInner {
.duration_since(UNIX_EPOCH)
.expect("time should be after epoch");

let block_delta_time = sys_block_time - self.prev_sys_block_time;
let block_delta_height = block_number - self.prev_block_number;
let block_delta_time = sys_block_time.saturating_sub(self.prev_sys_block_time);
let block_delta_height = block_number.saturating_sub(self.prev_block_number);
let candidate_gas_price = base_fee + candidate_gas_fees.max_priority_fee_per_gas;
let mut expired = Vec::new();
let mut num_candidates = 0;
Expand Down

0 comments on commit 9a84f6e

Please sign in to comment.