From b28068cc42882631799696b144d343686d2c3ebc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 26 Nov 2023 19:07:10 +0000 Subject: [PATCH] Drop panic if `rust-bitcoin` adds a new `Network` `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](https://github.com/rust-bitcoin/rust-bitcoin/issues/2225), we still shouldn't ba panicking, which we drop here in favor of a `debug_assert`ion, and a default value. --- lightning-invoice/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index d30fb638..d87c6c89 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -407,7 +407,10 @@ impl From for Currency { Network::Testnet => Currency::BitcoinTestnet, Network::Regtest => Currency::Regtest, Network::Signet => Currency::Signet, - _ => unreachable!(), + _ => { + debug_assert!(false, "Need to handle new rust-bitcoin network type"); + Currency::Regtest + }, } } } -- 2.30.2