bitcoindevkit / bitcoindevkit/bdk_wallet
[TRUC Transactions]: Specify the Maximum Acceptable Weight When Building a Transaction
- Dominant language
- Rust
- Stars
- 59
- Forks
- 105
- Avg merge
- 10d 9h
- Merged PRs (30d)
- 1
Description
From BIP 431:
```
4. A TRUC transaction cannot have a sigop-adjusted virtual size larger than 10,000 vB.
5. A TRUC transaction that has an unconfirmed TRUC ancestor cannot have a sigop-adjusted virtual size larger than 1000 vB.
```
These limits are now small enough that coin selection algorithms should be aware of these when building TRUC transactions (especially the 1000vB limit).
When TRUC transactions became standard in the v28.0 release, Bitcoin Core also added a `max_tx_weight` parameter to the `fundrawtransaction`, `walletcreatefundedpsbt`, and `send` RPCs via https://github.com/bitcoin/bitcoin/pull/29523.
In LDK, we currently plan to add an identical `max_tx_weight` parameter to our `CoinSelectionSource::select_confirmed_utxos` call to communicate these limits to the on-chain wallet (the same call will be used to fund transactions with both TRUC weight limits, as well as current V2 transactions which have a max weight of 400_000). If the on-chain wallet can't fulfill this limit, we expect the wallet to fail coin selection like Bitcoin Core's wallet.
We are *not blocking* on BDK supporting this feature as we already provide an out-of-the-box coin selection algorithm on top of our `WalletSource::list_confirmed_utxos` that will take these limits into account.
Nonetheless, some "max acceptable weight" parameter in BDK could be useful to anybody who would like to override LDK's coin-selection algorithm, or to anybody who wishes to build TRUC transactions with BDK.
Contributor guide
Assessment
This issue has not been assessed yet.