Skip to content

TxBuilder: Add an option to only use confirmed utxo's #42

Open
bitcoindevkit/bdk
#1855
@ErikDeSmedt

Description

@ErikDeSmedt

Describe the enhancement

I want to create a transaction and ensure that prevout has been confirmed onchain.

Similar to ChangeSpendPolicy I'd like to introduce a ConfirmationSpendPolicy.
This could be used to spend only Confirmed, Trusted or Any output.

The code to use it could look like the example below

wallet.create_tx()
    .add_recipient(address.script_pubkey(), payment_amount)
    .only_spend_confirmed_utxos()
    .finalize()

Use case

When creating a transaction I want to ensure it cannot be doublespent.
If I use an unconfirmed and untrusted prevout, I cannot guarantee the transaction will not be doublespent

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureNew feature or request

    Type

    No type

    Projects

    Status

    Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions