mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-01-31 02:52:14 +00:00
Clear UTXOs
This commit is contained in:
parent
71b2b1b6d2
commit
fedd238343
@ -316,6 +316,14 @@ impl LightClient {
|
|||||||
println!("Synced to {}, Downloaded {} kB \r",
|
println!("Synced to {}, Downloaded {} kB \r",
|
||||||
last_block, bytes_downloaded.load(Ordering::SeqCst) / 1024);
|
last_block, bytes_downloaded.load(Ordering::SeqCst) / 1024);
|
||||||
|
|
||||||
|
// TODO: This is a super hack. Clear all UTXOs
|
||||||
|
{
|
||||||
|
let mut txs = self.wallet.txs.write().unwrap();
|
||||||
|
for tx in txs.values_mut() {
|
||||||
|
tx.utxos.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch UTXOs
|
// Fetch UTXOs
|
||||||
self.wallet.tkeys.iter()
|
self.wallet.tkeys.iter()
|
||||||
.map( |sk| LightWallet::address_from_sk(&sk))
|
.map( |sk| LightWallet::address_from_sk(&sk))
|
||||||
|
@ -28,7 +28,7 @@ use zcash_primitives::{
|
|||||||
components::{Amount, OutPoint, TxOut}, components::amount::DEFAULT_FEE,
|
components::{Amount, OutPoint, TxOut}, components::amount::DEFAULT_FEE,
|
||||||
TxId, Transaction,
|
TxId, Transaction,
|
||||||
},
|
},
|
||||||
legacy::{Script, TransparentAddress::PublicKey},
|
legacy::{Script},
|
||||||
note_encryption::{Memo, try_sapling_note_decryption},
|
note_encryption::{Memo, try_sapling_note_decryption},
|
||||||
zip32::{ExtendedFullViewingKey, ExtendedSpendingKey, ChildIndex},
|
zip32::{ExtendedFullViewingKey, ExtendedSpendingKey, ChildIndex},
|
||||||
JUBJUB,
|
JUBJUB,
|
||||||
@ -357,11 +357,13 @@ pub struct WalletTx {
|
|||||||
// List of all Utxos recieved in this Tx. Some of these might be change notes
|
// List of all Utxos recieved in this Tx. Some of these might be change notes
|
||||||
pub utxos: Vec<Utxo>,
|
pub utxos: Vec<Utxo>,
|
||||||
|
|
||||||
// Total shielded value spent in this Tx. Note that this is the value of notes spent,
|
// Total shielded value spent in this Tx. Note that this is the value of the wallet's notes spent.
|
||||||
// the change is returned in the notes above. Subtract the two to get the actual value spent.
|
// Some change may be returned in one of the notes above. Subtract the two to get the actual value spent.
|
||||||
// Also note that even after subtraction, you might need to account for transparent inputs and outputs
|
// Also note that even after subtraction, you might need to account for transparent inputs and outputs
|
||||||
// to make sure the value is accurate.
|
// to make sure the value is accurate.
|
||||||
pub total_shielded_value_spent: u64,
|
pub total_shielded_value_spent: u64,
|
||||||
|
|
||||||
|
// TODO: Add total_transparent_spent, so it can be added to total_shielded_value_spent
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WalletTx {
|
impl WalletTx {
|
||||||
@ -735,8 +737,8 @@ impl LightWallet {
|
|||||||
|
|
||||||
// Scan the full Tx and update memos for incoming shielded transactions
|
// Scan the full Tx and update memos for incoming shielded transactions
|
||||||
pub fn scan_full_tx(&self, tx: &Transaction) {
|
pub fn scan_full_tx(&self, tx: &Transaction) {
|
||||||
|
// Scan outputs to see if anyone of them is us, and if it is, extract the memo
|
||||||
for output in tx.shielded_outputs.iter() {
|
for output in tx.shielded_outputs.iter() {
|
||||||
|
|
||||||
let ivks: Vec<_> = self.extfvks.iter().map(|extfvk| extfvk.fvk.vk.ivk()).collect();
|
let ivks: Vec<_> = self.extfvks.iter().map(|extfvk| extfvk.fvk.vk.ivk()).collect();
|
||||||
|
|
||||||
let cmu = output.cmu;
|
let cmu = output.cmu;
|
||||||
|
Loading…
Reference in New Issue
Block a user