diff --git a/zcash_client_sqlite/src/wallet/init/migrations/receiving_key_scopes.rs b/zcash_client_sqlite/src/wallet/init/migrations/receiving_key_scopes.rs
index 5f84be522..035f3f62b 100644
--- a/zcash_client_sqlite/src/wallet/init/migrations/receiving_key_scopes.rs
+++ b/zcash_client_sqlite/src/wallet/init/migrations/receiving_key_scopes.rs
@@ -2,25 +2,34 @@
use std::collections::HashSet;
+use group::ff::PrimeField;
+use incrementalmerkletree::Position;
use rusqlite::{self, named_params};
use schemer;
use schemer_rusqlite::RusqliteMigration;
+use shardtree::{store::ShardStore, ShardTree};
use uuid::Uuid;
-use sapling::note_encryption::{
- try_sapling_note_decryption, PreparedIncomingViewingKey, Zip212Enforcement,
+use sapling::{
+ note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey, Zip212Enforcement},
+ zip32::DiversifiableFullViewingKey,
+ Diversifier, Node, Rseed,
};
-use zcash_client_backend::keys::UnifiedFullViewingKey;
+use zcash_client_backend::{data_api::SAPLING_SHARD_HEIGHT, keys::UnifiedFullViewingKey};
use zcash_primitives::{
consensus::{self, sapling_zip212_enforcement, BlockHeight, BranchId},
- transaction::Transaction,
+ transaction::{components::amount::NonNegativeAmount, Transaction},
zip32::Scope,
};
-use crate::wallet::{
- init::{migrations::shardtree_support, WalletMigrationError},
- scan_queue_extrema, scope_code,
+use crate::{
+ wallet::{
+ commitment_tree::SqliteShardStore,
+ init::{migrations::shardtree_support, WalletMigrationError},
+ scan_queue_extrema, scope_code,
+ },
+ PRUNING_DEPTH, SAPLING_TABLES_PREFIX,
};
pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0xee89ed2b_c1c2_421e_9e98_c1e3e54a7fc2);
@@ -43,6 +52,52 @@ impl
schemer::Migration for Migration
{
}
}
+#[allow(clippy::type_complexity)]
+fn select_note_scope>(
+ commitment_tree: &mut ShardTree<
+ S,
+ { sapling::NOTE_COMMITMENT_TREE_DEPTH },
+ SAPLING_SHARD_HEIGHT,
+ >,
+ dfvk: &DiversifiableFullViewingKey,
+ diversifier: &sapling::Diversifier,
+ value: &sapling::value::NoteValue,
+ rseed: &sapling::Rseed,
+ note_commitment_tree_position: Position,
+) -> Result