1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 01:43:29 +01:00

Support testnet4 (#1104)

Following rust-bitcoin/rust-bitcoin#3453
This commit is contained in:
Roman Zeyde 2024-10-29 21:34:00 +02:00 committed by GitHub
parent bd6f93a1e3
commit 0f5f52e7dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -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]]

View File

@ -111,7 +111,10 @@ impl FromStr for BitcoinNetwork {
impl ::configure_me::parse_arg::ParseArgFromStr for BitcoinNetwork {
fn describe_type<W: fmt::Write>(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),