You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enforce ChannelTransactionParameters completeness at the type level
ChannelTransactionParameters used Option fields for counterparty
parameters and funding outpoint, relying on runtime unwrap/expect calls
scattered throughout the codebase. This was fragile since it was easy to
call code that assumed populated parameters on a not-yet-funded channel.
Split into PartialChannelTransactionParameters (used during negotiation)
and ChannelTransactionParameters (fully populated, used once funded).
Make FundingScope generic over the parameters type so the compiler
enforces which channel phases have complete data, eliminating the need
for runtime is_populated() guards in signers and elsewhere.
With the type-level distinction in place, also:
- Remove the InitialRemoteCommitmentReceiver trait, replacing it with a
ChannelContext method that takes complete parameters directly.
- Replace unset_funding_info with Channel::unfund(), which properly
transitions a funded channel back to unfunded state rather than
leaving it in an inconsistent "funded without funding info" state.
- Flatten DirectedChannelTransactionParameters to store resolved fields
directly instead of computing them on each access.
- Concretize methods that only work with complete parameters to take
FundingScope<ChannelTransactionParameters> directly, using field
access instead of trait-based Option-returning accessors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments