diff --git a/zcash_client_backend/src/data_api/testing/transparent.rs b/zcash_client_backend/src/data_api/testing/transparent.rs index 0717e1ef0..4832bf92c 100644 --- a/zcash_client_backend/src/data_api/testing/transparent.rs +++ b/zcash_client_backend/src/data_api/testing/transparent.rs @@ -106,6 +106,22 @@ where st.wallet().get_transparent_balances(account_id, height_2), Ok(h) if h.get(taddr) == Some(&value) ); + // TODO: Find our why this does not work. + + // let unshielded_balance = st.wallet().get_wallet_summary(0) + // .unwrap() + // .unwrap() + // .account_balances + // .get(&account_id) + // .unwrap() + // .unshielded_balance; + + // let mut expected_balance = Balance::ZERO; + + // expected_balance.add_pending_change_value(value).unwrap(); + + // assert_eq!(unshielded_balance, expected_balance); + } pub fn transparent_balance_across_shielding(dsf: DSF, cache: impl TestCache) diff --git a/zcash_client_sqlite/src/wallet/transparent.rs b/zcash_client_sqlite/src/wallet/transparent.rs index c5ab1f17b..97e6e803e 100644 --- a/zcash_client_sqlite/src/wallet/transparent.rs +++ b/zcash_client_sqlite/src/wallet/transparent.rs @@ -394,7 +394,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 :mempool_height - t.mined_height >= :min_confirmations -- has at least min_confirmations + AND t.mined_height <= (t.mined_height - :min_confirmations) -- has at least min_confirmations ) -- and the received txo is unspent AND u.id NOT IN ( @@ -433,8 +433,8 @@ pub(crate) fn add_transparent_account_balances( ON t.id_tx = u.transaction_id -- the transaction that created the output is mined with not enough confirmations or is definitely unexpired WHERE ( - (t.mined_height < :mempool_height - AND (:mempool_height - t.mined_height) < :min_confirmations) -- tx is mined but not confirmed + t.mined_height < :mempool_height + AND t.mined_height > (t.mined_height - :min_confirmations) -- tx is mined but not confirmed OR t.expiry_height = 0 -- tx will not expire OR t.expiry_height >= :mempool_height )