Closed
Description
Channel IDs are 32-byte IDs, and are represented simply as [u8; 32]
in LDK.
A new type could be introduced, as an abstraction of the channel ID type. This would be a refactoring.
Rationale:
- better representation of a type representing a channel ID (abstraction)
- potential for indicating when a channel ID is only temporary
- separation of anticipated 'new' channel IDs that are not based on outpoint, but on revocation points, coming with Dual funded / Splicing features (see Dual-funded channels and Splicing Project Tracking #1621 ).
Proposed change:
a ChannelId
enum, with values for outpoint-based and temporary IDs (and later revocation-based), all wrapping [u8; 32]
.
Alternatives of increasing complexity / code change needed:
- (current state) use native type
[u8; 32]
- a named type alias (
type ChannelId = [u8; 32]
). Can be used interchangebly. - a struct wrapping the native type, as 1-element tuple,
struct ChannelId(pub [u8; 32])
), similar toPaymentId
. Construction and usage sites need slight modification. - a struct wrapping the data in a private field, with accessor and special construction methods.
- an enum, with values for outpoint-based, temporary (and later revocation-based), all wrapping 32-byte array.
- (not recommended) a trait and different implementations for different variants.
Metadata
Metadata
Assignees
Labels
No labels