Add `ChannelPending` event emitted upon `funding_signed`
authorElias Rohrer <ero@tnull.de>
Fri, 10 Mar 2023 15:30:37 +0000 (16:30 +0100)
committerElias Rohrer <ero@tnull.de>
Mon, 3 Apr 2023 17:04:32 +0000 (19:04 +0200)
commit9873c7dad851a0ffa16f38a4788115cb5e0f5907
treeff33d37525255329e3a415207c2d341646f6cc86
parent0e28bcb704446a376f0c9be449de03fbb22a431f
Add `ChannelPending` event emitted upon `funding_signed`

Currently, users don't have good way of being notified when channel open
negotiations have succeeded and new channels are pending confirmation on
chain. To this end, we add a new `ChannelPending` event that is emitted
when send or receive a `funding_signed` message, i.e., at the last
moment before waiting for the confirmation period.

We track whether the event had previously been emitted in `Channel` and
remove it from `internal_funding_created` entirely. Hence, we now
only emit the event after ChannelMonitorUpdate completion, or upon
channel reestablish. This mitigates a race condition where where we
wouldn't persist the event *and* wouldn't regenerate it on restart,
therefore potentially losing it, if async CMU wouldn't complete before
ChannelManager persistence.
fuzz/src/chanmon_consistency.rs
lightning-background-processor/src/lib.rs
lightning/src/events/mod.rs
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/priv_short_conf_tests.rs
lightning/src/ln/reload_tests.rs