From 192da4ef60a32e9cd4f65e63fe66b16d684a091b Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 8 Feb 2023 00:00:00 +0000 Subject: [PATCH] Lowercase network values --- README.md | 1 + src/config.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 683efd7..13f46c6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ can be made by setting environment variables, whose usage is as follows: | RAPID_GOSSIP_SYNC_SERVER_DB_USER | alice | Username to access Postgres | | RAPID_GOSSIP_SYNC_SERVER_DB_PASSWORD | _None_ | Password to access Postgres | | RAPID_GOSSIP_SYNC_SERVER_DB_NAME | ln_graph_sync | Name of the database to be used for gossip storage | +| RAPID_GOSSIP_SYNC_SERVER_NETWORK | mainnet | Network to operate in. Possible values are mainnet, testnet, signet, regtest | | BITCOIN_REST_DOMAIN | 127.0.0.1 | Domain of the [bitcoind REST server](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md) | | BITCOIN_REST_PORT | 8332 | HTTP port of the bitcoind REST server | | BITCOIN_REST_PATH | /rest/ | Path infix to access the bitcoind REST endpoints | diff --git a/src/config.rs b/src/config.rs index 475d63a..1f968d6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,12 +19,13 @@ pub(crate) const SNAPSHOT_CALCULATION_INTERVAL: u32 = 3600 * 24; // every 24 hou pub(crate) const DOWNLOAD_NEW_GOSSIP: bool = true; pub(crate) fn network() -> Network { - let network = env::var("RAPID_GOSSIP_SYNC_SERVER_NETWORK").unwrap_or("Bitcoin".to_string()); + let network = env::var("RAPID_GOSSIP_SYNC_SERVER_NETWORK").unwrap_or("bitcoin".to_string()).to_lowercase(); match network.as_str() { - "Bitcoin" => Network::Bitcoin, - "Testnet" => Network::Testnet, - "Signet" => Network::Signet, - "Regtest" => Network::Regtest, + "mainnet" => Network::Bitcoin, + "bitcoin" => Network::Bitcoin, + "testnet" => Network::Testnet, + "signet" => Network::Signet, + "regtest" => Network::Regtest, _ => panic!("Invalid network"), } } -- 2.39.5