]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Add Signet support
authorCarl Dong <contact@carldong.me>
Thu, 25 Nov 2021 01:47:28 +0000 (20:47 -0500)
committerCarl Dong <contact@carldong.me>
Thu, 25 Nov 2021 01:47:28 +0000 (20:47 -0500)
README.md
src/cli.rs
src/main.rs

index 2da36cb3874e64151e68d6ff1847003c843e0fa3..d409800581ea0155a5a937dc4e6ddb1c5063276f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ cargo run <bitcoind-rpc-username>:<bitcoind-rpc-password>@<bitcoind-rpc-host>:<b
 ```
 `bitcoind`'s RPC username and password likely can be found through `cat ~/.bitcoin/.cookie`.
 
-`bitcoin-network`: defaults to `testnet`. Options: `testnet`, `regtest`.
+`bitcoin-network`: defaults to `testnet`. Options: `testnet`, `regtest`, and `signet`.
 
 `ldk-peer-listening-port`: defaults to 9735.
 
index 54b2eab7c5f46fda4ba7f60c39ee85a09c3fc6fb..42696c68b7f1de2dc004ccee818bc1c0c66a06de 100644 (file)
@@ -88,8 +88,9 @@ pub(crate) fn parse_startup_args() -> Result<LdkUserInfo, ()> {
        let network: Network = match env::args().skip(arg_idx).next().as_ref().map(String::as_str) {
                Some("testnet") => Network::Testnet,
                Some("regtest") => Network::Regtest,
+               Some("signet") => Network::Signet,
                Some(net) => {
-                       panic!("Unsupported network provided. Options are: `regtest`, `testnet`. Got {}", net);
+                       panic!("Unsupported network provided. Options are: `regtest`, `testnet`, and `signet`. Got {}", net);
                }
                None => Network::Testnet,
        };
@@ -669,7 +670,7 @@ fn get_invoice(
                Network::Bitcoin => Currency::Bitcoin,
                Network::Testnet => Currency::BitcoinTestnet,
                Network::Regtest => Currency::Regtest,
-               Network::Signet => panic!("Signet unsupported"),
+               Network::Signet => Currency::Signet,
        };
        let invoice = match utils::create_invoice_from_channelmanager(
                &channel_manager,
index 421069b804ed2aae75ebecc35389a4a4705203f0..389ff058143fe3b5854aa98b343a2baa812b15c2 100644 (file)
@@ -128,7 +128,7 @@ async fn handle_ldk_events(
                                        Network::Bitcoin => bitcoin_bech32::constants::Network::Bitcoin,
                                        Network::Testnet => bitcoin_bech32::constants::Network::Testnet,
                                        Network::Regtest => bitcoin_bech32::constants::Network::Regtest,
-                                       Network::Signet => panic!("Signet unsupported"),
+                                       Network::Signet => bitcoin_bech32::constants::Network::Signet,
                                },
                        )
                        .expect("Lightning funding tx should always be to a SegWit output")