Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to distinguish between Transparent pending change and pending non-change #1592

Open
pacu opened this issue Oct 24, 2024 · 0 comments

Comments

@pacu
Copy link
Contributor

pacu commented Oct 24, 2024

originated by #1411

function add_transparent_account_balances does not distinguish between change and non-change pending funds.

#[tracing::instrument(skip(conn, account_balances))]
pub(crate) fn add_transparent_account_balances(
conn: &rusqlite::Connection,
mempool_height: BlockHeight,
account_balances: &mut HashMap<AccountId, AccountBalance>,
) -> Result<(), SqliteClientError> {
let mut stmt_account_balances = conn.prepare(
"SELECT u.account_id, SUM(u.value_zat)

This responds to zcash_client_backend (backed by zcash_client_sqlite) not handling transparent change. When querying the AccountBalance of a particular account, the unshielded balance will return a Balance struct where the change_pending_confirmation field will always be NonNegativeAmount::ZERO.

Currently, zcash_client_backend assumes that ephemeral transparent addresses should only contain funds that will be spent on a subsequent transaction (e.g.: when sending funds from the shielded pool to a TEX Address).

// We don't need the TransparentAddressMetadata here; we can look it up from the data source later.
for ((change_index, change_value), (ephemeral_address, _)) in
ephemeral_outputs.iter().zip(addresses_and_metadata)
{
// This output is ephemeral; we will report an error in `create_proposed_transactions`
// if a later step does not consume it.
builder.add_transparent_output(&ephemeral_address, change_value.value())?;
transparent_output_meta.push((
Recipient::EphemeralTransparent {
receiving_account: account_id,
ephemeral_address,
outpoint_metadata: (),
},
ephemeral_address,
change_value.value(),
StepOutputIndex::Change(*change_index),

In order to enabling spending transparent funds beyond sending to TEX addresses, this assumption shouldn't be made anymore.

Related: #1360 #1370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant