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

Refactor AccountBalance to use Balance for transparent funds #1411

Open
str4d opened this issue Jun 13, 2024 · 0 comments · May be fixed by #1570
Open

Refactor AccountBalance to use Balance for transparent funds #1411

str4d opened this issue Jun 13, 2024 · 0 comments · May be fixed by #1570

Comments

@str4d
Copy link
Contributor

str4d commented Jun 13, 2024

Currently AccountBalance stores all unspent transparent funds as a single value, irrespective of confirmation depth:

/// Balance information for a single account. The sum of this struct's fields is the total balance
/// of the wallet.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct AccountBalance {
/// The value of unspent Sapling outputs belonging to the account.
sapling_balance: Balance,
/// The value of unspent Orchard outputs belonging to the account.
orchard_balance: Balance,
/// The value of all unspent transparent outputs belonging to the account, irrespective of
/// confirmation depth.
///
/// Unshielded balances are not subject to confirmation-depth constraints, because the only
/// possible operation on a transparent balance is to shield it, it is possible to create a
/// zero-conf transaction to perform that shielding, and the resulting shielded notes will be
/// subject to normal confirmation rules.
unshielded: NonNegativeAmount,
}

This is reasonable for the mobile SDKs, which explicitly do not support arbitrary spending of transparent funds (they must always be spent in a carefully-controlled manner, usually being shielded to a shielded address in the wallet first). However, for the zcashd wallet replacement we will need the ability to spend transparent funds, and thus to determine what transparent funds are suitable for selection. We will therefore need to distinguish to users between transparent funds that are available to the wallet for spending, and funds that still require confirmations.

The mobile SDKs can continue to behave as before, by adding up the separate fields to get the same value as they previously reported.

@str4d str4d added this to the Zcashd wallet replacement milestone Jun 13, 2024
pacu added a commit to pacu/librustzcash that referenced this issue Oct 13, 2024
pacu added a commit to pacu/librustzcash that referenced this issue Oct 22, 2024
pacu added a commit to pacu/librustzcash that referenced this issue Oct 24, 2024
pacu added a commit to pacu/librustzcash that referenced this issue Oct 26, 2024
pacu added a commit to pacu/librustzcash that referenced this issue Oct 26, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
pacu added a commit to pacu/librustzcash that referenced this issue Oct 28, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
pacu added a commit to pacu/librustzcash that referenced this issue Oct 28, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
pacu added a commit to pacu/librustzcash that referenced this issue Oct 28, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
daira pushed a commit to daira/librustzcash that referenced this issue Nov 2, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
pacu added a commit to pacu/librustzcash that referenced this issue Nov 4, 2024
…unds

closes zcash#1411

- Adds min_confirmations to transparent account balances
- Adds a new `transparent_balance_spendability` test to verify
transparent funds spendability.
- cargo clippy + cargo fmt

Refactor: Extract Method on lambda `check_balance`
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

Successfully merging a pull request may close this issue.

1 participant