mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-02-01 03:12:15 +00:00
Fix decoy tx fetching
This commit is contained in:
parent
1356ef809b
commit
b489870480
12
Cargo.toml
12
Cargo.toml
@ -40,33 +40,33 @@ rand = "0.7.2"
|
||||
|
||||
[dependencies.bellman]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
default-features = false
|
||||
features = ["groth16"]
|
||||
|
||||
[dependencies.pairing]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
|
||||
[dependencies.zcash_client_backend]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
default-features = false
|
||||
|
||||
[dependencies.zcash_primitives]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
default-features = false
|
||||
features = ["transparent-inputs"]
|
||||
|
||||
[dependencies.zcash_proofs]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
default-features = false
|
||||
|
||||
[dependencies.ff]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "0743dadcd017b60a0ac7123d04f0d6e7ce1e8016"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
features = ["ff_derive"]
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -619,7 +619,7 @@ impl LightClient {
|
||||
|
||||
match local_light_wallet.scan_block(encoded_block) {
|
||||
Ok(block_txns) => {
|
||||
all_txs.write().unwrap().copy_from_slice(&block_txns.iter().map(|txid| (txid.clone(), height as i32)).collect::<Vec<_>>()[..]);
|
||||
all_txs.write().unwrap().extend_from_slice(&block_txns.iter().map(|txid| (txid.clone(), height as i32)).collect::<Vec<_>>()[..]);
|
||||
},
|
||||
Err(invalid_height) => {
|
||||
// Block at this height seems to be invalid, so invalidate up till that point
|
||||
@ -698,18 +698,23 @@ impl LightClient {
|
||||
.map(|wtx| (wtx.txid, wtx.block))
|
||||
.collect::<Vec<(TxId, i32)>>();
|
||||
|
||||
info!("Fetching {} new txids, along with {} decoy", txids_to_fetch.len(), all_new_txs.read().unwrap().len());
|
||||
info!("Fetching {} new txids, total {} with decoy", txids_to_fetch.len(), all_new_txs.read().unwrap().len());
|
||||
txids_to_fetch.extend_from_slice(&all_new_txs.read().unwrap()[..]);
|
||||
|
||||
txids_to_fetch.sort();
|
||||
txids_to_fetch.dedup();
|
||||
|
||||
let mut rng = OsRng;
|
||||
txids_to_fetch.shuffle(&mut rng);
|
||||
|
||||
// And go and fetch the txids, getting the full transaction, so we can
|
||||
// read the memos
|
||||
// read the memos
|
||||
|
||||
for (txid, height) in txids_to_fetch {
|
||||
let light_wallet_clone = self.wallet.clone();
|
||||
info!("Fetching full Tx: {}", txid);
|
||||
responses.push(format!("Fetching full Tx: {}", txid));
|
||||
if print_updates {
|
||||
responses.push(format!("Fetching full Tx: {}", txid));
|
||||
}
|
||||
|
||||
fetch_full_tx(&self.get_server_uri(), txid, self.config.no_cert_verification, move |tx_bytes: &[u8] | {
|
||||
let tx = Transaction::read(tx_bytes).unwrap();
|
||||
|
@ -816,8 +816,10 @@ impl LightWallet {
|
||||
// Mark this Tx as scanned
|
||||
{
|
||||
let mut txs = self.txs.write().unwrap();
|
||||
let mut wtx = txs.get_mut(&tx.txid()).unwrap();
|
||||
wtx.full_tx_scanned = true;
|
||||
match txs.get_mut(&tx.txid()) {
|
||||
Some(wtx) => wtx.full_tx_scanned = true,
|
||||
None => {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user