mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Backport: Implement basic equivocations detection loop (#2375)
* Implement basic equivocations detection loop (#2367) * FinalityProofsBuf adjustments - store a Vec<FinalityProof> - transform prune `buf_limit` to Option * FinalityProof: add target_header_hash() * Target client: implement best_synced_header_hash() * Implement first version of the equivocations detection loop * Address code review comments * Leftover * polkadot-staging adjustments
This commit is contained in:
committed by
Bastian Köcher
parent
cc3bbc690b
commit
588508acd4
@@ -20,10 +20,11 @@ pub use bp_runtime::HeaderId;
|
||||
pub use error::Error;
|
||||
pub use relay_loop::{relay_loop, relay_metrics};
|
||||
pub use sp_runtime::traits::{UniqueSaturatedFrom, UniqueSaturatedInto};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use backoff::{backoff::Backoff, ExponentialBackoff};
|
||||
use futures::future::FutureExt;
|
||||
use futures::future::{BoxFuture, FutureExt};
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -134,12 +135,16 @@ pub enum TrackedTransactionStatus<BlockId> {
|
||||
#[async_trait]
|
||||
pub trait TransactionTracker: Send {
|
||||
/// Header id, used by the chain.
|
||||
type HeaderId: Clone + Send;
|
||||
type HeaderId: Clone + Debug + Send;
|
||||
|
||||
/// Wait until transaction is either finalized or invalidated/lost.
|
||||
async fn wait(self) -> TrackedTransactionStatus<Self::HeaderId>;
|
||||
}
|
||||
|
||||
/// Future associated with `TransactionTracker`, monitoring the transaction status.
|
||||
pub type TrackedTransactionFuture<T> =
|
||||
BoxFuture<'static, TrackedTransactionStatus<<T as TransactionTracker>::HeaderId>>;
|
||||
|
||||
/// Stringified error that may be either connection-related or not.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum StringifiedMaybeConnectionError {
|
||||
|
||||
Reference in New Issue
Block a user