Skip to content

Commit

Permalink
zcash_client_sqlite: Ensure we will query for status of unmined trans…
Browse files Browse the repository at this point in the history
…actions in `store_decrypted_tx`
  • Loading branch information
nuttycom committed Aug 16, 2024
1 parent 3089e3b commit 4059bfe
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions zcash_client_sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,14 +1202,6 @@ impl<P: consensus::Parameters> WalletWrite for WalletDb<rusqlite::Connection, P>
#[cfg(feature = "transparent-inputs")]
let mut tx_has_wallet_outputs = false;

#[cfg(feature = "transparent-inputs")]
let detectable_via_scanning = d_tx.tx().sapling_bundle().is_some();
#[cfg(all(feature = "transparent-inputs", feature = "orchard"))]
let detectable_via_scanning = detectable_via_scanning | d_tx.tx().orchard_bundle().is_some();

#[cfg(feature = "transparent-inputs")]
let mut queue_status_retrieval = false;

for output in d_tx.sapling_outputs() {
#[cfg(feature = "transparent-inputs")]
{
Expand Down Expand Up @@ -1507,13 +1499,6 @@ impl<P: consensus::Parameters> WalletWrite for WalletDb<rusqlite::Connection, P>
{
tx_has_wallet_outputs = true;
}

// If the decrypted transaction is unmined and has no shielded
// components, add it to the queue for status retrieval.
#[cfg(feature = "transparent-inputs")]
if d_tx.mined_height().is_none() && !detectable_via_scanning {
queue_status_retrieval = true;
}
}
} else {
warn!(
Expand Down Expand Up @@ -1543,13 +1528,21 @@ impl<P: consensus::Parameters> WalletWrite for WalletDb<rusqlite::Connection, P>

notify_tx_retrieved(wdb.conn.0, d_tx.tx().txid())?;

// If the decrypted transaction is unmined and has no shielded components, add it to
// the queue for status retrieval.
#[cfg(feature = "transparent-inputs")]
if queue_status_retrieval {
wallet::queue_tx_retrieval(
wdb.conn.0,
std::iter::once(d_tx.tx().txid()),
None
)?;
{
let detectable_via_scanning = d_tx.tx().sapling_bundle().is_some();
#[cfg(feature = "orchard")]
let detectable_via_scanning = detectable_via_scanning | d_tx.tx().orchard_bundle().is_some();

if d_tx.mined_height().is_none() && !detectable_via_scanning {
wallet::queue_tx_retrieval(
wdb.conn.0,
std::iter::once(d_tx.tx().txid()),
None
)?;
}
}

Ok(())
Expand Down

0 comments on commit 4059bfe

Please sign in to comment.