Skip to content

Drop panic if rust-bitcoin adds a new Network #2746

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

rust-bitcoin 0.30 added #[non_exhaustive] to the Network
enum, allowing them to "add support" for a new network type without
a major version change in the future. When upgrading, we added a
simple unreachable for the general match arm, which would break
in a minor version change of rust-bitcoin.

While it seems possible rust-bitcoin will change
this
,
we still shouldn't ba panicking, which we drop here in favor of a
debug_assertion, and a default value.

Plus one extra change.

`rust-bitcoin` 0.30 added `#[non_exhaustive]` to the `Network`
enum, allowing them to "add support" for a new network type without
a major version change in the future. When upgrading, we added a
simple `unreachable` for the general match arm, which would break
in a minor version change of `rust-bitcoin`.

While it seems [possible rust-bitcoin will change
this](rust-bitcoin/rust-bitcoin#2225),
we still shouldn't ba panicking, which we drop here in favor of a
`debug_assert`ion, and a default value.
Now that we use the `rust-bitcoin` `WitnessProgram` to check our
addresses, we can just rely on it, rather than checking the program
length and version.
@TheBlueMatt TheBlueMatt added this to the 0.0.119 milestone Nov 26, 2023
@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (70ea110) 88.55% compared to head (a41954d) 88.54%.

Files Patch % Lines
lightning-invoice/src/lib.rs 0.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2746      +/-   ##
==========================================
- Coverage   88.55%   88.54%   -0.01%     
==========================================
  Files         113      113              
  Lines       89323    89316       -7     
  Branches    89323    89316       -7     
==========================================
- Hits        79097    79086      -11     
- Misses       7860     7862       +2     
- Partials     2366     2368       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnull tnull merged commit 8bd4a8f into lightningdevkit:main Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants