diff --git a/Cargo.lock b/Cargo.lock index 1ed905210..bf6931a9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -956,6 +956,7 @@ dependencies = [ "bls12_381", "byteorder", "clearscreen", + "crossbeam-channel", "cxx", "ed25519-zebra", "group", diff --git a/Cargo.toml b/Cargo.toml index 72aaca016..e4e22ab9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ blake2b_simd = "1" blake2s_simd = "1" bls12_381 = "0.7" byteorder = "1" +crossbeam-channel = "0.5" group = "0.12" incrementalmerkletree = "0.3" libc = "0.2" diff --git a/src/rust/src/wallet_scanner.rs b/src/rust/src/wallet_scanner.rs index 1e2eb8c9d..390c34614 100644 --- a/src/rust/src/wallet_scanner.rs +++ b/src/rust/src/wallet_scanner.rs @@ -2,8 +2,8 @@ use core::fmt; use std::collections::HashMap; use std::io; use std::mem; -use std::sync::mpsc; +use crossbeam_channel as channel; use group::GroupEncoding; use zcash_note_encryption::{batch, BatchDomain, Domain, ShieldedOutput, ENC_CIPHERTEXT_SIZE}; use zcash_primitives::{ @@ -222,7 +222,7 @@ struct OutputIndex { value: V, } -type OutputReplier = OutputIndex>>>>; +type OutputReplier = OutputIndex>>>>; /// A batch of outputs to trial decrypt. struct Batch> { @@ -296,7 +296,7 @@ impl + Clone> Bat &mut self, domain: impl Fn() -> D, outputs: &[Output], - replier: mpsc::Sender>>>, + replier: channel::Sender>>>, ) { self.outputs .extend(outputs.iter().cloned().map(|output| (domain(), output))); @@ -313,7 +313,7 @@ type ResultKey = (BlockHash, TxId); /// Logic to run batches of trial decryptions on the global threadpool. struct BatchRunner> { acc: Batch, - pending_results: HashMap>>>>, + pending_results: HashMap>>>>, } impl BatchRunner @@ -356,7 +356,7 @@ where domain: impl Fn() -> D, outputs: &[Output], ) { - let (tx, rx) = mpsc::channel(); + let (tx, rx) = channel::unbounded(); self.acc.add_outputs(domain, outputs, tx); self.pending_results.insert((block_tag, txid), rx);