mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
TransactionInvalidationTracker (#1544)
* TransactionInvalidationTracker * TransacitonInvalidationTracker -> TransactionTracker * change sign_transaction method * clippy and spelling * removed comment * more transactiontracker tests * stalls_when_transaction_tracker_returns_error * remove test code * remove "impl TransactionTracker for ()" * enum TrackedTransactionStatus * test TransactionTracker in on_transaction_status * do_wait
This commit is contained in:
committed by
Bastian Köcher
parent
58fe2749d2
commit
70d6e91f20
@@ -20,6 +20,7 @@ pub use bp_runtime::HeaderId;
|
||||
pub use error::Error;
|
||||
pub use relay_loop::{relay_loop, relay_metrics};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use backoff::{backoff::Backoff, ExponentialBackoff};
|
||||
use futures::future::FutureExt;
|
||||
use std::time::Duration;
|
||||
@@ -119,6 +120,22 @@ pub trait MaybeConnectionError {
|
||||
fn is_connection_error(&self) -> bool;
|
||||
}
|
||||
|
||||
/// Final status of the tracked transaction.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum TrackedTransactionStatus {
|
||||
/// Transaction has been lost.
|
||||
Lost,
|
||||
/// Transaction has been mined and finalized.
|
||||
Finalized,
|
||||
}
|
||||
|
||||
/// Transaction tracker.
|
||||
#[async_trait]
|
||||
pub trait TransactionTracker: Send {
|
||||
/// Wait until transaction is either finalized or invalidated/lost.
|
||||
async fn wait(self) -> TrackedTransactionStatus;
|
||||
}
|
||||
|
||||
/// Stringified error that may be either connection-related or not.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum StringifiedMaybeConnectionError {
|
||||
|
||||
Reference in New Issue
Block a user