Problem: Funded channel with small fee. Confirmation doesn't occur for weeks (some block explorers re-broadcast transactions too)... This command will allow a user to add more fee after the fact.
Ideal (Does this require change in protocol spec? idk):
Less than ideal:
I'd like to start working on this, but it'd be nice to get some feedback on an approach:
I think initially we should go with the "less than ideal" CPFP solution because it doesn't require any protocol changes or nasty hacks like somehow interpreting rebroadcasts of open_channel with say an incremented temporary_channel_id (if that'd even be feasible - sounds pretty bad).
We can paper over the fact that CPFP is more or less a temporary bandaid by introducing an rpc/lncli command called fundingbump <temporary_channel_id> [<new_sat_per_byte>] or something along those lines. Once (and if) we can facilitate replace-by-fee, add some flag like --method={rbf,cpfp} which has some sensible default.
If maintainers agree that the CPFP approach outlined in OP is an acceptible stopgap and my approach sounds okay, I'll get coding.
ACK CPFP approach for now.
RBF is kind of messy...
Agreed that the CPFP route is easier for now, and also has less edge cases. Rather than make it specific to funding transactions, I think we can instead make it fully generalized. So maybe a command like: lncli feebump cpfp --outpoints=op1, op2, op3 --fee_rate=X. Notice that it takes a list of outpoints, so one could even anchor down a series of transactions with a single child.
One Q with this method would be how to interpret the --fee_rate param. One interoperation would be the new _cumulative_ package should have that particular fee rate. Another would be that this should just be the feerate of the child transaction, so it's up to the caller to properly compute this value.
Yup, agree that a more general feebump mechanism that'd allow multiple parent inputs seems very useful. I'll go that route.
Great, and important! any estimate as to when such feature could be available, and what could be a temporary solution?? (my funding transaction is stuck, miners "low priority"...). Thanks,
@rashlab I'm working on this at the moment, but I'm still getting to know lnd so I might be kinda slow. I'd say I'll have a PR up in the next two weeks?
Needless to say, I've fallen down on the job here - my apologies for the bad estimate. I took a crack at this, but not sure I'll have the time and/or skill to continue. Got stuck trying to figure out how to retrieve the outpoints to bump from the wallet and construct a txn using them as inputs.
Here's a rough outline of the task:
f (feeRate)rpcServerfThe sweeper currently being worked on by @joostjager will be possible to extend to handle this.
Got stuck trying to figure out how to retrieve the outpoints to bump from the wallet and construct a txn using them as inputs.
The assumption is that the outpoints would be passed over to the RPC, from there, there're calls to the WalletController to allow you to get things like the script and fee rate needed to sign for the change address.
Store txn somewhere?
The PublishTransaction method will automatically store the transaction before publishing. On restart, it'll re-publish them as necessary if they haven't been mined.
Most helpful comment
I'd like to start working on this, but it'd be nice to get some feedback on an approach:
I think initially we should go with the "less than ideal" CPFP solution because it doesn't require any protocol changes or nasty hacks like somehow interpreting rebroadcasts of
open_channelwith say an incremented temporary_channel_id (if that'd even be feasible - sounds pretty bad).We can paper over the fact that CPFP is more or less a temporary bandaid by introducing an rpc/lncli command called
fundingbump <temporary_channel_id> [<new_sat_per_byte>]or something along those lines. Once (and if) we can facilitate replace-by-fee, add some flag like--method={rbf,cpfp}which has some sensible default.If maintainers agree that the CPFP approach outlined in OP is an acceptible stopgap and my approach sounds okay, I'll get coding.