diff --git a/zebra-state/src/constants.rs b/zebra-state/src/constants.rs index 905a35969fd..167ce011955 100644 --- a/zebra-state/src/constants.rs +++ b/zebra-state/src/constants.rs @@ -107,20 +107,7 @@ pub const MAX_NON_FINALIZED_CHAIN_FORKS: usize = 10; pub const MAX_FIND_BLOCK_HASHES_RESULTS: u32 = 500; /// The maximum number of block headers allowed in `getheaders` responses in the Zcash network protocol. -const MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_PROTOCOL: u32 = 160; - -/// The maximum number of block headers sent by Zebra in `getheaders` responses. -/// -/// Older versions of Zcashd will blindly request more block headers as long as it -/// got 160 block headers in response to a previous query, -/// _even if those headers are already known_. -/// -/// To avoid this behavior, return slightly fewer than the maximum, -/// so `zcashd` thinks it has reached our chain tip. -/// -/// -pub const MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA: u32 = - MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_PROTOCOL - 2; +pub const MAX_FIND_BLOCK_HEADERS_RESULTS: u32 = 160; /// These database versions can be recreated from their directly preceding versions. pub const RESTORABLE_DB_VERSIONS: [u64; 1] = [26]; diff --git a/zebra-state/src/request.rs b/zebra-state/src/request.rs index 1863c56b2ed..56be011d48e 100644 --- a/zebra-state/src/request.rs +++ b/zebra-state/src/request.rs @@ -25,7 +25,7 @@ use zebra_chain::{ /// will work with inline links. #[allow(unused_imports)] use crate::{ - constants::{MAX_FIND_BLOCK_HASHES_RESULTS, MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA}, + constants::{MAX_FIND_BLOCK_HASHES_RESULTS, MAX_FIND_BLOCK_HEADERS_RESULTS}, ReadResponse, Response, }; @@ -721,7 +721,7 @@ pub enum Request { /// Stops the list of headers after: /// * adding the best tip, /// * adding the header matching the `stop` hash to the list, if it is in the best chain, or - /// * adding [`MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA`] headers to the list. + /// * adding [`MAX_FIND_BLOCK_HEADERS_RESULTS`] headers to the list. /// /// Returns an empty list if the state is empty. /// @@ -925,7 +925,7 @@ pub enum ReadRequest { /// Stops the list of headers after: /// * adding the best tip, /// * adding the header matching the `stop` hash to the list, if it is in the best chain, or - /// * adding [`MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA`] headers to the list. + /// * adding [`MAX_FIND_BLOCK_HEADERS_RESULTS`] headers to the list. /// /// Returns an empty list if the state is empty. /// diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index 4f970be89d4..adc61f887ae 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -44,8 +44,7 @@ use zebra_chain::{block::Height, serialization::ZcashSerialize}; use crate::{ constants::{ - MAX_FIND_BLOCK_HASHES_RESULTS, MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA, - MAX_LEGACY_CHAIN_BLOCKS, + MAX_FIND_BLOCK_HASHES_RESULTS, MAX_FIND_BLOCK_HEADERS_RESULTS, MAX_LEGACY_CHAIN_BLOCKS, }, service::{ block_iter::any_ancestor_blocks, @@ -1476,7 +1475,7 @@ impl Service for ReadStateService { &state.db, known_blocks, stop, - MAX_FIND_BLOCK_HEADERS_RESULTS_FOR_ZEBRA, + MAX_FIND_BLOCK_HEADERS_RESULTS, ) }, );