zcash_client_backend: Add some typedefs for complex types

This commit is contained in:
Jack Grigg 2022-09-13 21:58:32 +00:00
parent 8f03208439
commit f7b7760051
2 changed files with 7 additions and 6 deletions

View File

@ -42,6 +42,7 @@ struct OutputIndex<V> {
}
type OutputReplier<A, D> = OutputIndex<channel::Sender<OutputIndex<Option<DecryptedNote<A, D>>>>>;
type OutputResult<A, D> = channel::Receiver<OutputIndex<Option<DecryptedNote<A, D>>>>;
/// A batch of outputs to trial decrypt.
struct Batch<A, D: BatchDomain, Output: ShieldedOutput<D, COMPACT_NOTE_SIZE>> {
@ -130,8 +131,7 @@ type ResultKey = (BlockHash, TxId);
pub(crate) struct BatchRunner<A, D: BatchDomain, Output: ShieldedOutput<D, COMPACT_NOTE_SIZE>> {
batch_size_threshold: usize,
acc: Batch<A, D, Output>,
pending_results:
HashMap<ResultKey, channel::Receiver<OutputIndex<Option<DecryptedNote<A, D>>>>>,
pending_results: HashMap<ResultKey, OutputResult<A, D>>,
}
impl<A, D, Output> BatchRunner<A, D, Output>

View File

@ -177,10 +177,13 @@ pub fn scan_block<P: consensus::Parameters + Send + 'static, K: ScanningKey>(
)
}
type TaggedBatchRunner<P, S> =
BatchRunner<(AccountId, S), SaplingDomain<P>, CompactOutputDescription>;
pub(crate) fn add_block_to_runner<P, S>(
params: &P,
block: CompactBlock,
batch_runner: &mut BatchRunner<(AccountId, S), SaplingDomain<P>, CompactOutputDescription>,
batch_runner: &mut TaggedBatchRunner<P, S>,
) where
P: consensus::Parameters + Send + 'static,
S: Clone + Send + 'static,
@ -215,9 +218,7 @@ pub(crate) fn scan_block_with_runner<P: consensus::Parameters + Send + 'static,
nullifiers: &[(AccountId, Nullifier)],
tree: &mut CommitmentTree<Node>,
existing_witnesses: &mut [&mut IncrementalWitness<Node>],
mut batch_runner: Option<
&mut BatchRunner<(AccountId, K::Scope), SaplingDomain<P>, CompactOutputDescription>,
>,
mut batch_runner: Option<&mut TaggedBatchRunner<P, K::Scope>>,
) -> Vec<WalletTx<K::Nf>> {
let mut wtxs: Vec<WalletTx<K::Nf>> = vec![];
let block_height = block.height();