-
Notifications
You must be signed in to change notification settings - Fork 409
Write ChannelIds out as hex in Debug output #3306
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
Conversation
We do this for `Payment*` in `lightning-types` and its needed for the `hex_conservaitve` `impl_fmt_traits` macro which we'll use in the next commit.
`ChannelId`s are almost always referenced as hex, so having debug output print the raw bytes is somewhat annoying. Instead, we should dump them as hex the same way we do for `Display`. This uses the `hex_conservative` `impl_fmt_macros` which does all the work for us, like we use for `lightning_types`.
To remove the now-redundant `hex_conservative` explicit dependency.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3306 +/- ##
==========================================
- Coverage 89.63% 89.62% -0.01%
==========================================
Files 126 126
Lines 102166 102166
Branches 102166 102166
==========================================
- Hits 91572 91564 -8
- Misses 7869 7878 +9
+ Partials 2725 2724 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here, can we introduce a UserChannelId
type adding the same feature?
Do we want user channel IDs to print as hex? One intended use-case for them is database row IDs, which presumably users don't want to see as hex. |
Hm, well, not necessarily as hex, but IMO |
I'm not sure I understand how |
Alright. Besides the display/debugging preferences, I'd generally prefer to use a dedicated type parallel to |
Mmm, yea. I generally dislike the proliferation of newtypes so prefer to only use them sparingly where it really makes sense (eg because we have a million |
ChannelId
s are almost always referenced as hex, so having debugoutput print the raw bytes is somewhat annoying. Instead, we should
dump them as hex the same way we do for
Display
.This uses the
hex_conservative
impl_fmt_macros
which does allthe work for us, like we use for
lightning_types
.