diff --git a/zcash_client_sqlite/src/testing.rs b/zcash_client_sqlite/src/testing.rs index 83d0cd1735..b43e335835 100644 --- a/zcash_client_sqlite/src/testing.rs +++ b/zcash_client_sqlite/src/testing.rs @@ -474,6 +474,7 @@ where value, prior_cached_block.sapling_end_size, prior_cached_block.orchard_end_size, + false, ); (height, res, nf) @@ -529,6 +530,7 @@ where value: NonNegativeAmount, initial_sapling_tree_size: u32, initial_orchard_tree_size: u32, + allow_broken_hash_chain: bool, ) -> (Cache::InsertResult, Fvk::Nullifier) { let mut prior_cached_block = self .latest_cached_block_below_height(height) @@ -542,7 +544,9 @@ where // we need to generate a new prior cached block that the block to be generated can // successfully chain from, with the provided tree sizes. if prior_cached_block.chain_state.block_height() == height - 1 { - assert_eq!(prev_hash, prior_cached_block.chain_state.block_hash()); + if !allow_broken_hash_chain { + assert_eq!(prev_hash, prior_cached_block.chain_state.block_hash()); + } } else { let final_sapling_tree = (prior_cached_block.sapling_end_size..initial_sapling_tree_size).fold( diff --git a/zcash_client_sqlite/src/testing/pool.rs b/zcash_client_sqlite/src/testing/pool.rs index f23fecf28b..8f134faaa8 100644 --- a/zcash_client_sqlite/src/testing/pool.rs +++ b/zcash_client_sqlite/src/testing/pool.rs @@ -1312,6 +1312,7 @@ pub(crate) fn birthday_in_anchor_shard() { not_our_value, initial_sapling_tree_size, initial_orchard_tree_size, + false, ); for _ in 1..9 { st.generate_next_block(¬_our_key, AddressType::DefaultExternal, not_our_value); @@ -1392,6 +1393,7 @@ pub(crate) fn checkpoint_gaps() { not_our_value, st.latest_cached_block().unwrap().sapling_end_size, st.latest_cached_block().unwrap().orchard_end_size, + false, ); // Scan the block @@ -1888,6 +1890,7 @@ pub(crate) fn invalid_chain_cache_disconnected() { NonNegativeAmount::const_from_u64(8), 2, 2, + true, ); st.generate_next_block( &dfvk, diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index b4a0b4982a..9fd7848d3c 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -3103,6 +3103,7 @@ mod tests { not_our_value, 0, 0, + false, ); let (mid_height, _, _) = st.generate_next_block(¬_our_key, AddressType::DefaultExternal, not_our_value); diff --git a/zcash_client_sqlite/src/wallet/init/migrations/full_account_ids.rs b/zcash_client_sqlite/src/wallet/init/migrations/full_account_ids.rs index 45e0cc9f9c..b08d092e46 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/full_account_ids.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/full_account_ids.rs @@ -10,7 +10,9 @@ use zcash_keys::keys::UnifiedFullViewingKey; use zcash_primitives::consensus; use zip32::fingerprint::SeedFingerprint; -use super::{add_account_birthdays, receiving_key_scopes, v_transactions_note_uniqueness, wallet_summaries}; +use super::{ + add_account_birthdays, receiving_key_scopes, v_transactions_note_uniqueness, wallet_summaries, +}; /// The migration that switched from presumed seed-derived account IDs to supporting /// HD accounts and all sorts of imported keys. diff --git a/zcash_client_sqlite/src/wallet/scanning.rs b/zcash_client_sqlite/src/wallet/scanning.rs index 5853054339..0c3750174f 100644 --- a/zcash_client_sqlite/src/wallet/scanning.rs +++ b/zcash_client_sqlite/src/wallet/scanning.rs @@ -699,6 +699,7 @@ pub(crate) mod tests { value, initial_sapling_tree_size, initial_orchard_tree_size, + false, ); for _ in 1..=10 { @@ -1107,6 +1108,7 @@ pub(crate) mod tests { NonNegativeAmount::const_from_u64(10000), frontier_tree_size + 10, frontier_tree_size + 10, + false, ); st.scan_cached_blocks(max_scanned, 1); @@ -1293,6 +1295,7 @@ pub(crate) mod tests { NonNegativeAmount::const_from_u64(10000), frontier_tree_size + 10, frontier_tree_size + 10, + false, ); st.scan_cached_blocks(max_scanned, 1);