Skip to content

Commit ad86543

Browse files
committed
Add TODO for pending change and non-change handling zcash#1592
1 parent 3ce7dca commit ad86543

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zcash_client_sqlite/src/wallet/transparent.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ pub(crate) fn add_transparent_account_balances(
386386
min_confirmations: u32,
387387
account_balances: &mut HashMap<AccountId, AccountBalance>,
388388
) -> Result<(), SqliteClientError> {
389+
// TODO (#1592): Ability to distinguish between Transparent pending change and pending non-change
389390
let mut stmt_account_spendable_balances = conn.prepare(
390391
"SELECT u.account_id, SUM(u.value_zat)
391392
FROM transparent_received_outputs u
@@ -394,7 +395,7 @@ pub(crate) fn add_transparent_account_balances(
394395
-- the transaction that created the output is mined and with enough confirmations
395396
WHERE (
396397
t.mined_height < :mempool_height -- tx is mined
397-
AND t.mined_height <= (t.mined_height - :min_confirmations) -- has at least min_confirmations
398+
AND (:mempool_height - t.mined_height + 1) >= :min_confirmations -- has at least min_confirmations
398399
)
399400
-- and the received txo is unspent
400401
AND u.id NOT IN (
@@ -434,7 +435,7 @@ pub(crate) fn add_transparent_account_balances(
434435
-- the transaction that created the output is mined with not enough confirmations or is definitely unexpired
435436
WHERE (
436437
t.mined_height < :mempool_height
437-
AND t.mined_height > (t.mined_height - :min_confirmations) -- tx is mined but not confirmed
438+
AND (:mempool_height - t.mined_height + 1) < :min_confirmations -- tx is mined but not confirmed
438439
OR t.expiry_height = 0 -- tx will not expire
439440
OR t.expiry_height >= :mempool_height
440441
)

0 commit comments

Comments
 (0)