Skip to content

Commit

Permalink
Add TODO for pending change and non-change handling zcash#1592
Browse files Browse the repository at this point in the history
  • Loading branch information
pacu committed Oct 24, 2024
1 parent a0ca649 commit 32f7017
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zcash_client_sqlite/src/wallet/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ pub(crate) fn add_transparent_account_balances(
min_confirmations: u32,
account_balances: &mut HashMap<AccountId, AccountBalance>,
) -> Result<(), SqliteClientError> {
// TODO (#1592): Ability to distinguish between Transparent pending change and pending non-change
let mut stmt_account_spendable_balances = conn.prepare(
"SELECT u.account_id, SUM(u.value_zat)
FROM transparent_received_outputs u
Expand All @@ -394,7 +395,7 @@ pub(crate) fn add_transparent_account_balances(
-- the transaction that created the output is mined and with enough confirmations
WHERE (
t.mined_height < :mempool_height -- tx is mined
AND t.mined_height <= (t.mined_height - :min_confirmations) -- has at least min_confirmations
AND (:mempool_height - t.mined_height + 1) >= :min_confirmations -- has at least min_confirmations
)
-- and the received txo is unspent
AND u.id NOT IN (
Expand Down Expand Up @@ -434,7 +435,7 @@ pub(crate) fn add_transparent_account_balances(
-- the transaction that created the output is mined with not enough confirmations or is definitely unexpired
WHERE (
t.mined_height < :mempool_height
AND t.mined_height > (t.mined_height - :min_confirmations) -- tx is mined but not confirmed
AND (:mempool_height - t.mined_height + 1) < :min_confirmations -- tx is mined but not confirmed
OR t.expiry_height = 0 -- tx will not expire
OR t.expiry_height >= :mempool_height
)
Expand Down

0 comments on commit 32f7017

Please sign in to comment.