Check for transaction forwarding delay to detect an expired transaction before forwarding it (#4249)
Also refactored code for forwarding packets, and added test for it
This commit is contained in:
@ -24,6 +24,10 @@ pub const MAX_HASH_AGE_IN_SECONDS: usize = 120;
|
||||
// This must be <= MAX_HASH_AGE_IN_SECONDS, otherwise there's risk for DuplicateSignature errors
|
||||
pub const MAX_RECENT_BLOCKHASHES: usize = MAX_HASH_AGE_IN_SECONDS;
|
||||
|
||||
/// This is maximum time consumed in forwarding a transaction from one node to next, before
|
||||
/// it can be processed in the target node
|
||||
pub const MAX_TRANSACTION_FORWARDING_DELAY: usize = 3;
|
||||
|
||||
pub fn duration_as_ns(d: &Duration) -> u64 {
|
||||
d.as_secs() * 1_000_000_000 + u64::from(d.subsec_nanos())
|
||||
}
|
||||
|
Reference in New Issue
Block a user