From 6750b0b14cd1e7191b73399a9a465ee0103b4d2d Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:09:03 +0000 Subject: [PATCH 1/2] fix: do not wait for success event on tx --- src/txes/processor.rs | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/txes/processor.rs b/src/txes/processor.rs index 5b16eff..e38532b 100644 --- a/src/txes/processor.rs +++ b/src/txes/processor.rs @@ -246,28 +246,30 @@ async fn handle_substrate_native_tx( let tx_hash = tx_result.extrinsic_hash(); - let events = tx_result - .wait_for_finalized_success() - .await - .map_err(|e| Error::Custom(e.to_string()))?; - let block_hash = events.block_hash(); + println!("Tranasction sent with TxHash: {:?}", tx_hash); - // Find a Transfer event and print it. - let transfer_event = events - .find_first::() - .map_err(|e| Error::Custom(e.to_string()))?; - if let Some(event) = transfer_event { - let from = event.from; - let to = event.to; - let amount = event.amount.div(10u128.pow(18)); - println!("Transfered {amount} tokens {from} -> {to}"); - } + // let events = tx_result + // .wait_for_finalized_success() + // .await + // .map_err(|e| Error::Custom(e.to_string()))?; + // let block_hash = events.block_hash(); + + // // Find a Transfer event and print it. + // let transfer_event = events + // .find_first::() + // .map_err(|e| Error::Custom(e.to_string()))?; + // if let Some(event) = transfer_event { + // let from = event.from; + // let to = event.to; + // let amount = event.amount.div(10u128.pow(18)); + // println!("Transfered {amount} tokens {from} -> {to}"); + // } // Return the transaction hash. result_sender .send(Ok(TxResult::Substrate { tx_hash, - block_hash, + block_hash: tx_hash, })) .map_err(|e| { Error::Custom(format!("Failed to send tx_hash: {:?}", e)) From ea69613d0a758c6bbda55bfae9f49d6b87ecb0d3 Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:18:00 +0000 Subject: [PATCH 2/2] fix: clippy --- src/txes/processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/txes/processor.rs b/src/txes/processor.rs index e38532b..46add5e 100644 --- a/src/txes/processor.rs +++ b/src/txes/processor.rs @@ -1,4 +1,4 @@ -use std::ops::Div; + use std::sync::Arc; use crate::subxt::utils::H256;