From 148563b7e6277d9f48dc77a2a34772fa108d771d Mon Sep 17 00:00:00 2001 From: Kevin Gorham Date: Thu, 21 Feb 2019 10:52:13 -0500 Subject: [PATCH] modify scan operation to start from sapling activation. Rather than starting from zero because we do not need non-sapling blocks, prior to sapling's activation. --- src/main/rust/sql.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/rust/sql.rs b/src/main/rust/sql.rs index cfac0864..c0935b3d 100644 --- a/src/main/rust/sql.rs +++ b/src/main/rust/sql.rs @@ -30,6 +30,7 @@ use zip32::{ExtendedFullViewingKey, ExtendedSpendingKey}; // TODO: Expose this in zcash_client_backend const DEFAULT_FEE: i64 = 10000; const ANCHOR_OFFSET: u32 = 10; +const SAPLING_ACTIVATION_HEIGHT: i32 = 280_000; fn address_from_extfvk(extfvk: &ExtendedFullViewingKey) -> String { let addr = extfvk.default_address().unwrap().1; @@ -309,14 +310,14 @@ pub fn scan_cached_blocks, Q: AsRef>( let data = Connection::open(db_data)?; // Recall where we synced up to previously. - // If we have never synced, use 0 to select all cached CompactBlocks. + // If we have never synced, use sapling activation height to select all cached CompactBlocks. let mut last_height = data.query_row( "SELECT MAX(height) FROM blocks", NO_PARAMS, |row| match row.get_checked(0) { Ok(h) => h, - Err(_) => 0, + Err(_) => SAPLING_ACTIVATION_HEIGHT - 1, }, )?;