diff --git a/crates/builder/src/bundle_sender.rs b/crates/builder/src/bundle_sender.rs index d73905cb6..2a2317adb 100644 --- a/crates/builder/src/bundle_sender.rs +++ b/crates/builder/src/bundle_sender.rs @@ -331,6 +331,7 @@ where error!("Bundle send error {error:?}"); self.metrics.bundle_txns_failed.increment(1); state.bundle_error(error); + state.transaction_tracker.reset().await; } } diff --git a/crates/builder/src/transaction_tracker.rs b/crates/builder/src/transaction_tracker.rs index 65430ba07..e3f3dab30 100644 --- a/crates/builder/src/transaction_tracker.rs +++ b/crates/builder/src/transaction_tracker.rs @@ -295,6 +295,8 @@ where ); let sent_tx = self.sender.send_transaction(tx, expected_storage).await; + self.update_metrics(); + match sent_tx { Ok(sent_tx) => { info!( @@ -494,6 +496,10 @@ where async fn reset(&mut self) { let nonce = self.get_external_nonce().await.unwrap_or(self.nonce); self.set_nonce_and_clear_state(nonce); + // reset metrics when tracker reset. + self.metrics.num_pending_transactions.set(0); + self.metrics.current_max_fee_per_gas.set(0); + self.metrics.max_priority_fee_per_gas.set(0); } fn abandon(&mut self) {