Minor code cleanup.

This commit is contained in:
Kris Nuttycombe 2021-05-14 14:16:10 -06:00
parent bd65b01eb3
commit 8e3e7de50c
2 changed files with 13 additions and 17 deletions

View File

@ -57,7 +57,7 @@ where
.ok_or(Error::SaplingNotActive)?; .ok_or(Error::SaplingNotActive)?;
let sapling_outputs = decrypt_transaction(params, height, tx, &extfvks); let sapling_outputs = decrypt_transaction(params, height, tx, &extfvks);
if !(sapling_outputs.is_empty() && tx.vout.is_empty()) { if !(sapling_outputs.is_empty() && tx.vout.is_empty()) {
let nullifiers = data.get_all_nullifiers()?; let nullifiers = data.get_all_nullifiers()?;
data.store_decrypted_tx( data.store_decrypted_tx(

View File

@ -569,22 +569,18 @@ impl<'a, P: consensus::Parameters> WalletWrite for DataConnStmtCache<'a, P> {
// as our z->t tx and store the vouts as our sent notes. // as our z->t tx and store the vouts as our sent notes.
// FIXME this is a weird heuristic that is bound to trip us up somewhere. // FIXME this is a weird heuristic that is bound to trip us up somewhere.
// d_tx.tx.shielded_spends.iter().find(|input| nullifiers.iter().any(|(_, n)| { *n == input.nullifier } )) { if let Some((account_id, _)) = nullifiers.iter().find(|(_, nf)|
d_tx.tx.shielded_spends.iter().any(|input| *nf == input.nullifier)
match nullifiers.iter().find(|(_, n)| d_tx.tx.shielded_spends.iter().any(|input| *n == input.nullifier )) { ) {
Some(tx_input) => { for (output_index, txout) in d_tx.tx.vout.iter().enumerate() {
for (output_index, txout) in d_tx.tx.vout.iter().enumerate() { wallet::put_sent_utxo(
wallet::put_sent_utxo( up,
up, tx_ref,
tx_ref, output_index,
output_index, *account_id,
tx_input.0, &txout.script_pubkey.address().unwrap(),
&txout.script_pubkey.address().unwrap(), txout.value,
txout.value, )?;
)?;
}
},
None => {
} }
} }
} }