Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daira-Emma Hopwood <[email protected]>
  • Loading branch information
nuttycom and daira authored Aug 9, 2024
1 parent 52f7a77 commit 4b12e61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 3 additions & 9 deletions zcash_client_sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,15 +1209,9 @@ impl<P: consensus::Parameters> WalletWrite for WalletDb<rusqlite::Connection, P>
let mut tx_has_wallet_outputs = false;

#[cfg(feature = "transparent-inputs")]
let detectable_via_scanning = {
#[allow(unused_mut)]
let mut detectable_via_scanning = d_tx.tx().sapling_bundle().is_some();
#[cfg(feature = "orchard")] {
detectable_via_scanning |= d_tx.tx().orchard_bundle().is_some();
}

detectable_via_scanning
};
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();

for output in d_tx.sapling_outputs() {
#[cfg(feature = "transparent-inputs")]
Expand Down
5 changes: 2 additions & 3 deletions zcash_client_sqlite/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2404,15 +2404,14 @@ pub(crate) fn queue_tx_retrieval(
query_type: TxQueryType,
dependent_tx_ref: Option<TxRef>,
) -> Result<(), SqliteClientError> {
// Add an entry to the transaction retrieval queue if we don't already have raw transaction data.
// Add an entry to the transaction retrieval queue if it would not be redundant.
let mut stmt_insert_tx = conn.prepare_cached(
"INSERT INTO tx_retrieval_queue (txid, query_type, dependent_transaction_id)
SELECT :txid, :query_type, :dependent_transaction_id
-- do not queue enhancement requests if we already have the raw transaction
WHERE NOT EXISTS (
WHERE :query_type <> :enhancement_type OR NOT EXISTS (
SELECT 1 FROM transactions
WHERE txid = :txid
AND :query_type = :enhancement_type
AND raw IS NOT NULL
)
-- if there is already a status request, we can upgrade it to an enhancement request
Expand Down

0 comments on commit 4b12e61

Please sign in to comment.