get10101 / 10101-PoC

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

`attempt to subtract with overflow` after opening a channel #488

Closed da-kami closed 1 year ago

da-kami commented 1 year ago

I think this is a regression but of https://github.com/itchysats/10101/pull/479 ? Looking into it

da-kami commented 1 year ago

analysis: This can happen if opening the channel fails several times, but then succeeds.

There is no means to know which maker_funding_txid should be associated with which channel_open_txid.

With #479 we store the channel_open_txid after extracting it from the current channel - if there were previous entries that are ignored, but the channel opening failed the channel_open_txid will still be saved for these, because there is no means to know that those are entries for failed channel opens at the moment.

I don't think we can easily solve this in the current weird solution. I think the best I can do here is use a saturating_sub and ignore the error. The logic is correct - we should just not have channel open failures because we generally can't deal with them correctly (i.e. the funds that the maker sent remain in the taker's wallet... )😅