Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More info on send errors #750

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/ethereum/write_provider/tx_sitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ impl TxSitter {
tx_id: TransactionId,
) -> Result<TransactionResult, TxError> {
loop {
let tx = self.client.get_tx(&tx_id).await.map_err(TxError::Send)?;
let tx = self
.client
.get_tx(&tx_id)
.await
.context("Error fetching tx")
.map_err(TxError::Send)?;

if tx.status == TxStatus::Mined || tx.status == TxStatus::Finalized {
return Ok(TransactionResult {
Expand Down Expand Up @@ -79,6 +84,7 @@ impl Inner for TxSitter {
tx_id: None,
})
.await
.context("Error sending transaction")
.map_err(TxError::Send)?;

Ok(tx.tx_id)
Expand All @@ -89,21 +95,23 @@ impl Inner for TxSitter {
.client
.get_txs(Some(TxStatus::Unsent))
.await
.context("Error fetching unsent transactions")
.map_err(TxError::Send)?;

let pending_txs = self
.client
.get_txs(Some(TxStatus::Pending))
.await
.context("Error fetching pending transactions")
.map_err(TxError::Send)?;

let mut txs = vec![];
let mut tx_ids = vec![];

for tx in unsent_txs.into_iter().chain(pending_txs) {
txs.push(tx.tx_id);
tx_ids.push(tx.tx_id);
}

Ok(txs)
Ok(tx_ids)
}

async fn mine_transaction(&self, tx: TransactionId) -> Result<TransactionResult, TxError> {
Expand Down
Loading