From 326a4282bb5334c2e91cd824fb409687d84bce90 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Thu, 17 Oct 2019 15:21:05 -0700 Subject: [PATCH] Compute max blockhash age accounting for slot duration (#6421) * Compute max blockhash age accounting for slot duration * Update comment for the constant --- sdk/src/clock.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/src/clock.rs b/sdk/src/clock.rs index c9f0761f17..93bb5f2cc8 100644 --- a/sdk/src/clock.rs +++ b/sdk/src/clock.rs @@ -28,8 +28,9 @@ pub const NUM_CONSECUTIVE_LEADER_SLOTS: u64 = 4; /// not be processed by the network. 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; +// Number of maximum recent blockhashes (one blockhash per slot) +pub const MAX_RECENT_BLOCKHASHES: usize = + MAX_HASH_AGE_IN_SECONDS * DEFAULT_TICKS_PER_SECOND as usize / DEFAULT_TICKS_PER_SLOT as usize; // The maximum age of a blockhash that will be accepted by the leader pub const MAX_PROCESSING_AGE: usize = MAX_RECENT_BLOCKHASHES / 2;