lnd
lnd copied to clipboard
Handling non-confirmed funding transactions
Issue
During the current funding workflow, the responder should forget the channel if the funding transaction is not confirmed within a reasonable timeout. For lnd
this timeout is currently set to 288 blocks.
The funder (initiator) of the channel cannot forget about the channel if the funding transaction is broadcast, since he has funded the transaction with coins. Therefore, we should make sure the money is returned to the funder's wallet.
Steps to completion:
-
[x] Prevent the funder from forgetting about the channel if the
fundingManager
gets restarted while waiting for the funding transaction to confirm. Currently, on restart it will launch agoroutine
that will timeout after 288 blocks, but this should only be done for the channel responder. -
[ ] Determine how to reclaim the funds. We can either double spend the input to the funding transaction back into our wallet, or broadcast the commitment transaction and sweep the funds using CPFP.
Extra credits: We might also be able to bump the fee of the funding transaction to get it confirmed, but this would possibly need some more advanced scripting features, due to changing the amounts int the funding tx changes the txid
, which the commitment tx relies on.
I'll try to resolve this issue.
I've done the first part #514
It would be really neat to also be able to "cancel" the opening of a channel and reclaim the funds while the funding transaction is unconfirmed, even if the timout hasn't expired. This way you could avoid having to wait for the timeout.
First portion fixed by #514.
Hi if nobody is working on this, I'd like to take it
Since I haven't gotten a reply I'll assume nobody is working on this and work on it myself
I believe @wpaulino has started on this one.
On Wed, Jul 11, 2018 at 4:47pm, Eugene < [email protected] [[email protected]] > wrote: Since I haven't gotten a reply I'll assume nobody is working on this and work on it myself
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [https://github.com/lightningnetwork/lnd/issues/386#issuecomment-404196823] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ADl15MEKau2-xao1LRCKVajwy9gAuqfyks5uFhAYgaJpZM4QBLco] .
Ah ok I'll find a diff issue then
I'm really sorry I didn't give any news. I no longer work on this problem indeed.
currently working on this
From #3149:
After discussing this a bit we have come to the conclusion we do not want to introduce more persistent state during the funding process. Instead we should let the fundingmanager
- unlock the coins after a timeout, making them spendable in other transactions.
- In combination with something like #1755 this should allow it to gracefully fail the channel.
To bump the fee on an unconfirmed channel manually, the current bump fee logic can be used.
Another suggestion here is to allow the cancellation of the funding transaction by doublespending it back to the chain wallet. This can be useful in the scenario I just went through where I set low-ish fees, and then the China outage happened, causing the funding tx to confirm after the two week window. I knew it was going to take a while and would have liked to double spend back to self in order to avoid having to pay 3x chain for [fund,force close,sweep].
Note that double-spending is currently not detected be neither funder nor receiver. This is a massive pain in loptos as PayJoin occasionally fails and fallback transaction double spends the inputs.
I'm having a look at bringing https://github.com/lightningnetwork/lnd/pull/1755 up to date. I'm working on integration tests, in theory it should be working though.
I can create a draft PR if it's of interest
@johng that'd be awesome!
Latest PR working on this is #5567, will takeover if contributor is no longer working on it.
Current PR in progress to address this issue: https://github.com/lightningnetwork/lnd/pull/7036