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.
This commit is contained in:
Kevin Gorham 2019-02-21 10:52:13 -05:00
parent 531df67856
commit 148563b7e6
1 changed files with 3 additions and 2 deletions

View File

@ -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<P: AsRef<Path>, Q: AsRef<Path>>(
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,
},
)?;