mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
use transaction tracker in messages relay (#1581)
This commit is contained in:
committed by
Bastian Köcher
parent
86be60ad40
commit
e534e90193
@@ -88,30 +88,3 @@ pub fn transaction_stall_timeout(
|
||||
.map(|mortality_period| average_block_interval.saturating_mul(mortality_period + 1 + 1))
|
||||
.unwrap_or(default_stall_timeout)
|
||||
}
|
||||
|
||||
/// Returns stall timeout for relay loop that submit transactions to two chains.
|
||||
///
|
||||
/// Bidirectional relay may have two active transactions. Even if one of them has been spoiled, we
|
||||
/// can't just restart the loop - the other transaction may still be alive and we'll be submitting
|
||||
/// duplicate transaction, which may result in funds loss. So we'll be selecting maximal mortality
|
||||
/// for choosing loop stall timeout.
|
||||
pub fn bidirectional_transaction_stall_timeout(
|
||||
left_mortality_period: Option<u32>,
|
||||
right_mortality_period: Option<u32>,
|
||||
left_average_block_interval: Duration,
|
||||
right_average_block_interval: Duration,
|
||||
default_stall_timeout: Duration,
|
||||
) -> Duration {
|
||||
std::cmp::max(
|
||||
transaction_stall_timeout(
|
||||
left_mortality_period,
|
||||
left_average_block_interval,
|
||||
default_stall_timeout,
|
||||
),
|
||||
transaction_stall_timeout(
|
||||
right_mortality_period,
|
||||
right_average_block_interval,
|
||||
default_stall_timeout,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user