Merge branch 'master' of github.com:adityapk00/zecwallet-light-cli

This commit is contained in:
Aditya Kulkarni
2019-10-29 14:45:04 -07:00
3 changed files with 28 additions and 10 deletions

View File

@@ -767,7 +767,7 @@ impl LightWallet {
None => true
}
})
.map(|nd| if nd.spent.is_none() { nd.note.value } else { 0 })
.map(|nd| if nd.spent.is_none() && nd.unconfirmed_spent.is_none() { nd.note.value } else { 0 })
.sum::<u64>()
})
.sum::<u64>()

View File

@@ -706,6 +706,12 @@ fn test_z_spend_to_z() {
let branch_id = u32::from_str_radix("2bb40e60", 16).unwrap();
let (ss, so) = get_sapling_params().unwrap();
// Make sure that the balance exists
{
assert_eq!(wallet.zbalance(None), AMOUNT1);
assert_eq!(wallet.verified_zbalance(None), AMOUNT1);
}
// Create a tx and send to address
let raw_tx = wallet.send_to_address(branch_id, &ss, &so,
vec![(&ext_address, AMOUNT_SENT, Some(outgoing_memo.clone()))]).unwrap();
@@ -736,6 +742,12 @@ fn test_z_spend_to_z() {
assert_eq!(mem[&sent_txid].outgoing_metadata[0].memo.to_utf8().unwrap().unwrap(), outgoing_memo);
}
{
// The wallet should deduct this from the balance and verified balance
assert_eq!(wallet.zbalance(None), 0);
assert_eq!(wallet.verified_zbalance(None), 0);
}
let mut cb3 = FakeCompactBlock::new(2, block_hash);
cb3.add_tx(&sent_tx);
wallet.scan_block(&cb3.as_bytes()).unwrap();