From 2041b76c3cc25cad687c3beb968365d6882172c7 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Tue, 29 Oct 2024 09:26:55 +0200 Subject: [PATCH] Support testnet4 --- internal/config_specification.toml | 2 +- src/config.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/config_specification.toml b/internal/config_specification.toml index 75aad9bca..c0bc8e009 100644 --- a/internal/config_specification.toml +++ b/internal/config_specification.toml @@ -58,7 +58,7 @@ doc = "JSONRPC authentication cookie file (default: ~/.bitcoin/.cookie)" name = "network" type = "crate::config::BitcoinNetwork" convert_into = "::bitcoin::Network" -doc = "Select Bitcoin network type ('bitcoin', 'testnet', 'regtest' or 'signet')" +doc = "Select Bitcoin network type ('bitcoin', 'testnet', 'testnet4', 'regtest' or 'signet')" default = "Default::default()" [[param]] diff --git a/src/config.rs b/src/config.rs index e7499e04f..430e9aebc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -111,7 +111,10 @@ impl FromStr for BitcoinNetwork { impl ::configure_me::parse_arg::ParseArgFromStr for BitcoinNetwork { fn describe_type(mut writer: W) -> fmt::Result { - write!(writer, "either 'bitcoin', 'testnet', 'regtest' or 'signet'") + write!( + writer, + "either 'bitcoin', 'testnet', 'testnet4', 'regtest' or 'signet'" + ) } } @@ -205,6 +208,7 @@ impl Config { let db_subdir = match config.network { Network::Bitcoin => "bitcoin", Network::Testnet => "testnet", + Network::Testnet4 => "testnet4", Network::Regtest => "regtest", Network::Signet => "signet", unsupported => unsupported_network(unsupported), @@ -215,6 +219,7 @@ impl Config { let default_daemon_rpc_port = match config.network { Network::Bitcoin => 8332, Network::Testnet => 18332, + Network::Testnet4 => 48332, Network::Regtest => 18443, Network::Signet => 38332, unsupported => unsupported_network(unsupported), @@ -222,6 +227,7 @@ impl Config { let default_daemon_p2p_port = match config.network { Network::Bitcoin => 8333, Network::Testnet => 18333, + Network::Testnet4 => 48333, Network::Regtest => 18444, Network::Signet => 38333, unsupported => unsupported_network(unsupported), @@ -229,6 +235,7 @@ impl Config { let default_electrum_port = match config.network { Network::Bitcoin => 50001, Network::Testnet => 60001, + Network::Testnet4 => 40001, Network::Regtest => 60401, Network::Signet => 60601, unsupported => unsupported_network(unsupported), @@ -236,6 +243,7 @@ impl Config { let default_monitoring_port = match config.network { Network::Bitcoin => 4224, Network::Testnet => 14224, + Network::Testnet4 => 44224, Network::Regtest => 24224, Network::Signet => 34224, unsupported => unsupported_network(unsupported), @@ -283,6 +291,7 @@ impl Config { match config.network { Network::Bitcoin => (), Network::Testnet => config.daemon_dir.push("testnet3"), + Network::Testnet4 => config.daemon_dir.push("testnet4"), Network::Regtest => config.daemon_dir.push("regtest"), Network::Signet => config.daemon_dir.push("signet"), unsupported => unsupported_network(unsupported),