Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix(eth-sender): etter error handling in eth-sender (matter-labs#2163)
Browse files Browse the repository at this point in the history
Signed-off-by: tomg10 <[email protected]>
  • Loading branch information
tomg10 authored Jun 6, 2024
1 parent 500d462 commit 0cad504
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions core/node/eth_sender/src/eth_tx_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,22 +310,26 @@ impl EthTxManager {
tx_history_id: u32,
raw_tx: RawTransactionBytes,
current_block: L1BlockNumber,
) -> Result<H256, EthSenderError> {
) -> Result<(), EthSenderError> {
match self.query_client().send_raw_tx(raw_tx).await {
Ok(tx_hash) => {
Ok(_) => {
storage
.eth_sender_dal()
.set_sent_at_block(tx_history_id, current_block.0)
.await
.unwrap();
Ok(tx_hash)
Ok(())
}
Err(error) => {
storage
.eth_sender_dal()
.remove_tx_history(tx_history_id)
.await
.unwrap();
// In transient errors, server may have received the transaction
// we don't want to loose record about it in case that happens
if !error.is_transient() {
storage
.eth_sender_dal()
.remove_tx_history(tx_history_id)
.await
.unwrap();
}
Err(error.into())
}
}
Expand Down

0 comments on commit 0cad504

Please sign in to comment.