-
Notifications
You must be signed in to change notification settings - Fork 922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Speed up channel opening via CPFP+RBF #475
Comments
Thinking more, it seems that using RBF for onchain withdrawals requires withdrawals to wait for channel funding to confirm at least once, and channel funding to wait for withdrawals to confirm at least once. The issue with using RBF is the below race condition:
Thus we cannot spend from the change output of an RBF transaction until the RBF transaction confirms deeply enough. At the minimum, we should suspend fundchannel commands if there are pending RBF withdrawals and there are not enough unspent coins, but the RBF withdrawal change output does have enough coins. There is also the question of the below race condition:
In the above case we should use the transaction U and not T. Of course, deeper reorgs are also theoretically possible. Note that this is also important when we are receiving funds. RBF gets complicated, so I suppose there is a reason why it is not well-implemented. Ideally we should be able to accelerate both withdrawals and channel funding. |
CPFP could be useful as a workaround, but I generally don't like it because it's quite expensive. If transaction A paid $1 in fees and is stuck, then in order to increase its effective fee to $1.50, you need to generate a child transaction B with $2 in fees. So you'd be spending $2, whereas RBF would only cost $0.50 (assuming equal size). It's also cheaper to avoid change outputs when opening a channel, see #665. I opened #668 to keep track of both approaches. |
CPFP+RBF is simpler to implement under our current one-peer-one-channel architecture. Of course we probably want to have multiple channels per peer eventually, there are a few |
A more general approach would be to have How to implement that is something of an open question however. We can CPFP by creating a new transaction spending from the change output of any transaction we created ourselves. However, this new CPFP transaction should be RBF-able, so that further But supporting RBF probably means additional complexity in our wallet logic. In particular, if we implement Thoughts @niftynei @rustyrussell ? I think you are the main people hacking around the new PSBT-based wallet bits currently. |
Anyway here is a new proposed interface:
|
Hi @rustyrussell @cdecker The current state of mempool is making this a burning requirement, as a-lot of people inadvertently low ball the channel opening fee and then are stuck in mempool with pending transactions. |
This would be an awesome addition to the project and would definitely be helpful in this fee environment |
You can do CPFP today if you use an external wallet to make the funding tx
and it has a change output.
RBF has been implemented for experimental dual-funding/v2 opens.
…On Fri, Mar 26, 2021 at 18:28 Evan Kaloudis ***@***.***> wrote:
This would be an awesome addition to the project and would definitely be
helpful in this fee environment
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIMAKPPRS37PWSSS4SSRQTTFUKDJANCNFSM4EJUVVFA>
.
|
The
* 100000 = 100sat/vbyte |
Reviving this old thread, but I got into situation where I opened channel with feerate=low and mempool started filling up. Because I opened from whole utxo (no change), I can't use CPFP. In this situation RBF bump fee option would be useful even in regular, not dual funding channel. LND has possibility to do /me now going to quietly panic about potentially stuck channel opening |
want to bring this up again. I have 3 closing txs stuck in mempool and no idea what to do Is a CPFP possible? If yes, how? What about the withdraw command here?
Please, I really need help to get those tx confirmed |
Hi @Surenic what type of channel close are we talking about here, coop or force? If it's a force close and you initiated the close, you would need to wait till your lock time (or CSV delay) before you are in a position to CPFP the transaction |
It is indeed a coop close. How do I know if the outputs are sizable? And what would be the CHANGE_INDEX then? Can you help me building the right command? Don't want to make anything wrong
Filled in the tx already and set fees to 30 sats/vB NEW_CHANGE_ADDRESS - can I use any address or does it have to be a CLN Wallet address? Right now my CLN wallet is completely empty. Would the fees be taken from the original UTXOs or do I need to put some sats on it? 🙏 thank you |
Hi @Surenic, here's what you can do:
The fee will be taken from the unconfirmed output, so you don't have to worry about not having any sats on your wallet. |
Thank you @saubyk, unfortunately I get an Unknown UTXO error. I am sure that I have the correct txid and change_index (0), but it doesn't work. I was thinking that the tx is out of my mempool so I even resent it via bitcoin-cli sendwartransaction txhex, but this doesn't work too. I am out ideas now |
Not sure if this will help, but you can try |
I did that but the command was calling for But I definitely want to say thank you again for not giving up on helping me :) edit: allowhighfees is a boolean so I had to set it to true. the tx was then sent with a success message. But anyway, the withdraw command fails with an unknown UTXO. Just to be clear, don't have anything to hide here anymore: https://mempool.space/tx/cadb70f6b467f79a7fe969fe5b465f82d7369d3b4f6e3db2215c5a2ff2778085 the unconfirmed tx, its tx hash equals the txid? the output, which belongs to me is 0 so this command should be correct?
|
hi @Surenic the command you posted should've worked. It would help if you post the exact error message that you're getting when you execute it. My guess is that transaction is not in the mempool and I am unsure if cc @rustyrussell in case you have any other insights |
Hi, lightning-cli sendrawtransaction 0200000001184...009d73a821a485871b224c91b2f843b435f8d95fdffffff015c7501000000000016001487600cee9bde83edff7f4b15d39b35c0098161e120170c00 allowhighfees=true what's wrong here? |
@leblitzdick You didn't specify |
Thanks, I didn't know that! |
An idea, is to ensure as much as possible that channel funding transactions have a "change" output that is controlled by the built-in onchain wallet.
Then, if the funding transaction takes a long time to confirm on mainnet (due to the well-known congestion problems there), it would be possible to accelerate the channel funding transaction by creating a child transaction from the "change" output. This child transaction would have a larger-than-usual feerate (CPFP) to encourage mining of the channel funding transaction, and pay out to yet another address of the built-in onchain wallet. In addition, the child transaction would be marked RBF so that further increases of the fee can be done.
Using CPFP to speed up the channel funding transaction has the advantage that it requires no change to the Lightning BOLT protocol. Using RBF on the channel funding transaction directly requires that the both ends of the channel sign new versions of the commitment transaction.
While not a priority, I suspect this feature would be necessary before we can practically deploy to mainnet.
At the JSON-RPC level, I imagine:
Further calls to fundchannelaccelerate will be possible and will RBF the child transaction instead.
The fundchannelaccelerate command will silently fail without an error if the specified channel is already confirmed at least once.
Implementation-wise, we would need a new table for pending channel funding transactions. Entries in this table will be removed when the peer enters
CHANNELD_NORMAL
.When initially created only the
funding_tx_change_outnum
column has a non-null value. The first fundchannelaccelerate will fill incpfp_feerate
, with future calls bumping the feerate and recreating the CPFP acceleration transaction. fundchannelaccelerateestimate will compute a fee based on whethercpfp_feerate
exists or not and assuming a simple 1-input 1-output RBF transaction. Care point is when the change output runs out: this will cause acceleration to fail as there is no longer any change to pay with.Since lightningd will now scan UTXOs that appear onchain we should not use
addfunds
especially since the child transaction is RBF.The text was updated successfully, but these errors were encountered: