Rename `VALIDATION_DEPTH` constant to `VERIFY_LOOKAHEAD`
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
e16aa41117
commit
c7b308b312
|
@ -89,8 +89,8 @@ use wallet::commitment_tree::put_shard_roots;
|
|||
/// this delta from the chain tip to be pruned.
|
||||
pub(crate) const PRUNING_DEPTH: u32 = 100;
|
||||
|
||||
/// The number of blocks to re-verify when the chain tip is updated.
|
||||
pub(crate) const VALIDATION_DEPTH: u32 = 10;
|
||||
/// The number of blocks to verify ahead when the chain tip is updated.
|
||||
pub(crate) const VERIFY_LOOKAHEAD: u32 = 10;
|
||||
|
||||
pub(crate) const SAPLING_TABLES_PREFIX: &str = "sapling";
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ use zcash_client_backend::{
|
|||
wallet::WalletTx,
|
||||
};
|
||||
|
||||
use crate::VALIDATION_DEPTH;
|
||||
use crate::VERIFY_LOOKAHEAD;
|
||||
use crate::{
|
||||
error::SqliteClientError, SqlTransaction, WalletCommitmentTrees, WalletDb, PRUNING_DEPTH,
|
||||
};
|
||||
|
@ -834,7 +834,7 @@ pub(crate) fn truncate_to_height<P: consensus::Parameters>(
|
|||
)?;
|
||||
|
||||
// Prioritize the range starting at the height we just rewound to for verification
|
||||
let query_range = block_height..(block_height + VALIDATION_DEPTH);
|
||||
let query_range = block_height..(block_height + VERIFY_LOOKAHEAD);
|
||||
let scan_range = ScanRange::from_parts(query_range.clone(), ScanPriority::Verify);
|
||||
replace_queue_entries(conn, &query_range, Some(scan_range).into_iter())?;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use zcash_primitives::consensus::{self, BlockHeight, NetworkUpgrade};
|
|||
use zcash_client_backend::data_api::SAPLING_SHARD_HEIGHT;
|
||||
|
||||
use crate::error::SqliteClientError;
|
||||
use crate::{PRUNING_DEPTH, VALIDATION_DEPTH};
|
||||
use crate::{PRUNING_DEPTH, VERIFY_LOOKAHEAD};
|
||||
|
||||
use super::block_height_extrema;
|
||||
|
||||
|
@ -669,7 +669,7 @@ pub(crate) fn update_chain_tip<P: consensus::Parameters>(
|
|||
let stable_height = new_tip.saturating_sub(PRUNING_DEPTH);
|
||||
|
||||
// If the wallet's prior tip is above the stable height, prioritize the range between
|
||||
// it and the new tip as `ChainTip`. Otherwise, prioritize the `VALIDATION_DEPTH`
|
||||
// it and the new tip as `ChainTip`. Otherwise, prioritize the `VERIFY_LOOKAHEAD`
|
||||
// blocks above the wallet's prior tip as `Verify`. Since `scan_cached_blocks`
|
||||
// retrieves the metadata for the block being connected to, the connectivity to the
|
||||
// prior tip will always be checked. Since `Verify` ranges have maximum priority, even
|
||||
|
@ -684,7 +684,7 @@ pub(crate) fn update_chain_tip<P: consensus::Parameters>(
|
|||
// and advance it up to at most the stable height. The shard entry will then cover
|
||||
// the range to the new tip at the lower `ChainTip` priority.
|
||||
ScanRange::from_parts(
|
||||
prior_tip..min(stable_height, prior_tip + VALIDATION_DEPTH),
|
||||
prior_tip..min(stable_height, prior_tip + VERIFY_LOOKAHEAD),
|
||||
ScanPriority::Verify,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue