Skip to content

Commit b28068c

Browse files
committed
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](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.
1 parent 70ea110 commit b28068c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning-invoice/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,10 @@ impl From<Network> for Currency {
407407
Network::Testnet => Currency::BitcoinTestnet,
408408
Network::Regtest => Currency::Regtest,
409409
Network::Signet => Currency::Signet,
410-
_ => unreachable!(),
410+
_ => {
411+
debug_assert!(false, "Need to handle new rust-bitcoin network type");
412+
Currency::Regtest
413+
},
411414
}
412415
}
413416
}

0 commit comments

Comments
 (0)