bitcoindevkit / bdk

A modern, lightweight, descriptor-based wallet library written in Rust!
Other
838 stars 300 forks source link

Expose way to select only (n-)confirmed UTXOs for TX creation #1029

Open tnull opened 1 year ago

tnull commented 1 year ago

Describe the enhancement
Add a way to create transactions with bdk::Wallet that only spend confirmed UTXOs. This could easily be done by adding a corresponding must_only_use_confirmed_tx field to TxParams and ORing it into

https://github.com/bitcoindevkit/bdk/blob/81c76133911b3a99a4e1303052f96c858ca65cf5/crates/bdk/src/wallet/mod.rs#L1473

However, TxParams is currently pending exposure: https://github.com/bitcoindevkit/bdk/blob/81c76133911b3a99a4e1303052f96c858ca65cf5/crates/bdk/src/wallet/tx_builder.rs#L129

Use case
This is needed to use BDK's coin selection for bumping transactions generated by LDK, in particular for https://docs.rs/lightning/0.0.116-alpha1/lightning/events/bump_transaction/trait.CoinSelectionSource.html#tymethod.select_confirmed_utxos

danielabrozzoni commented 1 year ago

Concept ACK, I've added this one to #988 so that I don't forget about it.

You probably already know this, but as a workaround you could add all the unconfirmed utxos to the unspendable list :/

tnull commented 1 year ago

Concept ACK, I've added this one to #988 so that I don't forget about it.

Ah, thank you!

You probably already know this, but as a workaround you could add all the unconfirmed utxos to the unspendable list :/

Ah, yeah, it's a bit clunky but makes sense I guess.