Hi all!
As part of the anchor outputs work for Lightning (in the context of eclair), I'm wondering if it's possible to use psbts and the bumpfee RPC or if I'll have to implement a lot of fee bumping code myself outside of bitcoind.
A quick summary of the situation (a lot more details here if you're interested):
- we have a "commit tx" that represents the state of the channel
- this "commit tx" has an output for CPFP carve-out (called "anchor") that we use to bump the fee (through a "claim anchor tx")
commit tx
+--------------+
| vout |
| +----------+ |
| | output 1 | |
| +----------+ |
| ... |
| +----------+ |
| | anchor | |-------+
| +----------+ | | claim anchor tx
| ... | | +-----------------------------------+
| +----------+ | | | vin vout |
| | output n | | | | +-------------+ +-------------+ |
| +----------+ | +------>| | anchor utxo | | wallet utxo | |
+--------------+ | +-------------+ +-------------+ |
| +-------------+ |
unrelated tx +------>| | wallet utxo | |
+--------------+ | | +-------------+ |
| vout | | +-----------------------------------+
| +----------+ | |
| | output 1 | |-------+
| +----------+ |
| ... |
| +----------+ |
| | output m | |
| +----------+ |
+--------------+
The bitcoind wallet doesn't have the keys necessary to spend the "anchor"; these are handled by the lightning node.
But I'd like to let bitcoind chose what inputs and outputs to add to that transaction to achieve a given feerate.
This looks like a perfect use-case for PSBT:
- use
bitcoind'swalletcreatefundedpsbtto obtain a wallet psbt - create a lightning psbt with only the anchor utxo as input
- use
joinpsbtsto gather all inputs/outputs - use
walletprocesspsbtto get signatures for the wallet inputs - add the signature for the anchor input and finalize the psbt
Once that's done, I can publish my "claim anchor tx".
However if it still doesn't confirm in time, I'd like to RBF that transaction.
But obviously bumpfee will not work out of the box because there's one input that it can't automatically re-sign.
What would be really great would be if bumpfee could replace all wallet inputs/outputs to bump the fee (abiding by all the BIP 125 rules) and then return a psbt with all the wallet inputs signed; I would then only need to re-sign the anchor input, finalize the psbt and broadcast it.
IIUC 0.20.0 has taken a first step in that direction (returning a psbt in bumpfee), but it looks like it will only do that with a watch-only wallet, whereas I'd like that behavior with normal wallet too. Does this request make sense, and if so is this being currently worked on?