Rework channel lifecyle events #3237
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We emit several events during the channel lifecycle, which have become a bit of a mess over the years, especially with the addition of 0-conf, splicing and on-the-fly funding.
We now use the following events:
ChannelCreatedonce the funding transaction is createdChannelFundingConfirmedonce the funding transaction is confirmed, which is also emitted for splice transactionsChannelReadyForPaymentsonce the channel is ready for payments, after exchangingchannel_readyfor the channel creation orsplice_lockedfor splice transactionsThe order between
ChannelFundingConfirmedandChannelReadyForPaymentsdepends on whether 0-conf is used or not.We remove
ChannelOpened, which was actually a subset of the existingChannelReadyForPaymentsevent (which was added afterwards).We add a few fields to existing channel events, which we don't yet store in the DB to avoid modifying it, but will store later when we modify the schema of the
AuditDb.We now store an entry in the
AuditDbwhenever a splice transaction confirms, which allows tracking the full history of a channel's changes.