get10101 / 10101-PoC

The world needs more Lightning!
MIT License
17 stars 3 forks source link

Closing channel requires 1 confirmation before funds are returned #461

Closed holzeis closed 1 year ago

holzeis commented 1 year ago

Observed while debugging #440.

Is this delay intended?


EDIT: Used to be 6 confirmations, now it's 1 (maybe even 0 and I'm just impatient, but it's definitely not instant as the 2 transactions must be published and found in the mempool or on-chain) thanks to https://github.com/lightningdevkit/rust-lightning/commit/86531aa2ecdc228ae3788fda7332511c08870a69.

As @da-kami pointed out, a reasonable UX must be ensured regardless. The user needs to know that we are waiting for something to happen before the Lightning and Bitcoin balances are updated.

bonomat commented 1 year ago

It looks like this is a hard requirement in the ldk: https://github.com/itchysats/rust-lightning/blob/f4f1093edc506314484c8d52a40dd155e692394b/lightning/src/chain/channelmonitor.rs#L397-L401

The field ANTI_REORG_DELAY is hardcoded to 6, letting us spend this output only after 6 confirmation

da-kami commented 1 year ago

Interesting - do we see it as pending balance or not at all?

bonomat commented 1 year ago

Interesting - do we see it as pending balance or not at all?

not at all until after the 6 blocks

da-kami commented 1 year ago

Interesting - do we see it as pending balance or not at all?

not at all until after the 6 blocks

That sucks, that's definitely not a nice UX :/

luckysori commented 1 year ago

I've updated LDK to deal with this: https://github.com/lightningdevkit/rust-lightning/commit/86531aa2ecdc228ae3788fda7332511c08870a69. It's included in #482.