Skip to content

Make it possible to determine the number of confirmations remaining before spendability for each of a given transaction's outputs. #2045

@nuttycom

Description

@nuttycom

In investigating Electric-Coin-Company/zcash-swift-wallet-sdk#1616, @LukasKorba and I determined that there is not currently a good mechanism for determining the spendability of received transaction outputs relative to any particular confirmations policy. While it would be possible to implement such a function in each wallet SDK, we should instead implement this as part of the data access API so that we can ensure that spendability determinations are the same between balance, note selection, and this sort of metadata retrieval.

This is likely best implemented by adding a method to WalletRead with something like the signature:

fn get_received_outputs(
    &self,
    txid: TxId,
    confirmations_policy: ConfirmationsPolicy,
) -> Result<Vec<ReceivedTransactionOutput>, Self::Error>;

pub struct ReceivedTransactionOutput {
    pool_type: PoolType,
    output_index: usize,
    value: Zatoshis,
    confirmations_until_spendable: u32,
}

It would be convenient if instead we could modify v_tx_outputs to return this metadata, but since we can't provide the confirmations policy when querying a view it seems necessary to add a dedicated method for this purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions