Make MAX_RECENT_BLOCKHASHES <= MAX_HASH_AGE_IN_SECONDS (#3679)

* Make MAX_RECENT_BLOCKHASHES == MAX_HASH_AGE_IN_SECONDS
This commit is contained in:
carllin 2019-04-09 11:45:25 -07:00 committed by GitHub
parent 76e524ae48
commit 4f232cbc27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -21,8 +21,8 @@ pub const NUM_CONSECUTIVE_LEADER_SLOTS: u64 = 8;
/// not be processed by the network.
pub const MAX_HASH_AGE_IN_SECONDS: usize = 120;
pub const MAX_RECENT_BLOCKHASHES: usize =
(NUM_TICKS_PER_SECOND * MAX_HASH_AGE_IN_SECONDS as u64 / DEFAULT_TICKS_PER_SLOT) as usize;
// 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;
pub fn duration_as_us(d: &Duration) -> u64 {
(d.as_secs() * 1000 * 1000) + (u64::from(d.subsec_nanos()) / 1_000)