Skip to content

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed May 31, 2024
1 parent 8be9d5a commit d72a8d1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions crates/relayer/src/chain/namada/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ impl NamadaChain {
thread::sleep(WAIT_BACKOFF);

for tx_sync_result in tx_sync_results.iter_mut() {
self.update_tx_sync_result(tx_sync_result)?;
if let Err(e) = self.update_tx_sync_result(tx_sync_result) {
debug!("update_tx_sync_result failed. It will be retried: {e}");
}
}
}
}
Expand All @@ -338,14 +340,13 @@ impl NamadaChain {
if let TxStatus::Pending { .. } = tx_sync_result.status {
// If the transaction failed, query_txs returns the IbcEvent::ChainError,
// so that we don't attempt to resolve the transaction later on.
if let Ok(events) = self.query_tx_events(&tx_sync_result.response.hash) {
// If we get events back, progress was made, so we replace the events
// with the new ones. in both cases we will check in the next iteration
// whether or not the transaction was fully committed.
if !events.is_empty() {
tx_sync_result.events = events;
tx_sync_result.status = TxStatus::ReceivedResponse;
}
let events = self.query_tx_events(&tx_sync_result.response.hash)?;
// If we get events back, progress was made, so we replace the events
// with the new ones. in both cases we will check in the next iteration
// whether or not the transaction was fully committed.
if !events.is_empty() {
tx_sync_result.events = events;
tx_sync_result.status = TxStatus::ReceivedResponse;
}
}
Ok(())
Expand Down

0 comments on commit d72a8d1

Please sign in to comment.