@@ -68,7 +68,7 @@ impl EthTxManager {
68
68
& self ,
69
69
storage : & mut Connection < ' _ , Core > ,
70
70
op : & EthTx ,
71
- ) -> Option < ExecutedTxStatus > {
71
+ ) -> Result < Option < ExecutedTxStatus > , EthSenderError > {
72
72
// Checking history items, starting from most recently sent.
73
73
for history_item in storage
74
74
. eth_sender_dal ( )
@@ -80,16 +80,19 @@ impl EthTxManager {
80
80
// because if we do and get an `Err`, we won't finish the for loop,
81
81
// which means we might miss the transaction that actually succeeded.
82
82
match self . l1_interface . get_tx_status ( history_item. tx_hash ) . await {
83
- Ok ( Some ( s) ) => return Some ( s) ,
83
+ Ok ( Some ( s) ) => return Ok ( Some ( s) ) ,
84
84
Ok ( _) => continue ,
85
- Err ( err) => tracing:: warn!(
86
- "Can't check transaction {:?}: {:?}" ,
87
- history_item. tx_hash,
88
- err
89
- ) ,
85
+ Err ( err) => {
86
+ tracing:: warn!(
87
+ "Can't check transaction {:?}: {:?}" ,
88
+ history_item. tx_hash,
89
+ err
90
+ ) ;
91
+ return Err ( err) ;
92
+ }
90
93
}
91
94
}
92
- None
95
+ Ok ( None )
93
96
}
94
97
95
98
pub ( crate ) async fn send_eth_tx (
@@ -253,29 +256,26 @@ impl EthTxManager {
253
256
. await ?;
254
257
let blobs_operator_address = self . l1_interface . get_blobs_operator_account ( ) ;
255
258
256
- if let Some ( res) = self
257
- . monitor_inflight_transactions_inner ( storage, l1_block_numbers, operator_nonce, None )
258
- . await ?
259
- {
260
- return Ok ( Some ( res) ) ;
261
- } ;
262
-
263
259
if let Some ( blobs_operator_nonce) = blobs_operator_nonce {
264
260
// need to check if both nonce and address are `Some`
265
261
if blobs_operator_address. is_none ( ) {
266
262
panic ! ( "blobs_operator_address has to be set its nonce is known; qed" ) ;
267
263
}
268
- Ok ( self
264
+ if let Some ( res ) = self
269
265
. monitor_inflight_transactions_inner (
270
266
storage,
271
267
l1_block_numbers,
272
268
blobs_operator_nonce,
273
269
blobs_operator_address,
274
270
)
275
- . await ?)
276
- } else {
277
- Ok ( None )
271
+ . await ?
272
+ {
273
+ return Ok ( Some ( res) ) ;
274
+ }
278
275
}
276
+
277
+ self . monitor_inflight_transactions_inner ( storage, l1_block_numbers, operator_nonce, None )
278
+ . await
279
279
}
280
280
281
281
async fn monitor_inflight_transactions_inner (
@@ -347,11 +347,11 @@ impl EthTxManager {
347
347
) ;
348
348
349
349
match self . check_all_sending_attempts ( storage, & tx) . await {
350
- Some ( tx_status) => {
350
+ Ok ( Some ( tx_status) ) => {
351
351
self . apply_tx_status ( storage, & tx, tx_status, l1_block_numbers. finalized )
352
352
. await ;
353
353
}
354
- None => {
354
+ Ok ( None ) => {
355
355
// The nonce has increased but we did not find the receipt.
356
356
// This is an error because such a big re-org may cause transactions that were
357
357
// previously recorded as confirmed to become pending again and we have to
@@ -361,6 +361,13 @@ impl EthTxManager {
361
361
& tx
362
362
) ;
363
363
}
364
+ Err ( err) => {
365
+ // An error here means that we weren't able to check status of one of the txs
366
+ // we can't continue to avoid situations with out-of-order confirmed txs
367
+ // (for instance Execute tx confirmed before PublishProof tx) as this would make
368
+ // our API return inconsistent block info
369
+ return Err ( err) ;
370
+ }
364
371
}
365
372
}
366
373
Ok ( None )
0 commit comments