librustzcash
librustzcash copied to clipboard
Refactor `AccountBalance` to use `Balance` for transparent funds
Currently AccountBalance
stores all unspent transparent funds as a single value, irrespective of confirmation depth:
https://github.com/zcash/librustzcash/blob/5a2a670ffca5d81e54c166d0f6b5cf5bcce84f32/zcash_client_backend/src/data_api.rs#L211-L229
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.