mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-24 14:50:46 +01:00
When doing an unilateral close (local or remote), we previously weren't watching htlc outputs to decide whether the commit was finished or not. This was incorrect because we didn't make sure the htlc-related transactions had indeed been confirmed on the blockchain, making us potentially lose money. This is not trivial, because htlc transactions may be double-spent by the counterparty, dependending on scenarios (ex: `htlc-timeout` vs `claim-success`). On top of that, there may be several different kind of commits in competition at the same time. With this change, we now: - put `WatchConfirm` watches on the commitment tx, and on all outputs only us control (eg: our main output) ; - put `WatchSpent` watches on the outputs that may be double spent by the counterparty; when such an output is spent, we put a `WatchConfirm` on the corresponding transaction and keep track of all outpoints spent ; - every time a new transaction is confirmed, we find out if there are some remaining transactions waiting for confirmation, taking into account the fact that some 2nd/3rd-stage txs may never confirm because their input has been doublespent. We also don't rely anymore on dedicated `BITCOIN_CLOSE_DONE`, `BITCOIN_LOCALCOMMIT_DONE`, ... events. |
||
---|---|---|
.. | ||
src | ||
eclair-cli | ||
pom.xml |