-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstraction of ChannelId type #2408
Comments
I agree this would be nice to have dedicated types for many of the parameters used in the public API. Note that in LDK Node we have a I think we'd eventually like to have similar types for |
Thanks for writing this up! I think we should try to write the enum variant. I'm not sure that it'll be practical, but my first guess is at least most cases it'll be trivial, but its always possible we'll go through it and then find that there's some places where its just not practical and we have to stick with one of the non-enum versions. |
Work-in-progress status: |
I do not recommend an enum, or storing the channel ID 'type' information, on the grounds:
My recommendation:
(Updated description, this alternative is number 3.) |
Fair enough. Kinda wish we had some way to get that info, but you're right it doesn't make sense. |
The possibility is open to later change the struct to an enum or extend with a enum type field, if it is needed or makes sense. Introducing a type is an improvement in any case. |
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:
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:
[u8; 32]
type ChannelId = [u8; 32]
). Can be used interchangebly.struct ChannelId(pub [u8; 32])
), similar toPaymentId
. Construction and usage sites need slight modification.The text was updated successfully, but these errors were encountered: