From 79fa1e82afed90bffa96497adcede043c762b97c Mon Sep 17 00:00:00 2001 From: junderw Date: Sat, 12 Oct 2024 20:43:34 +0900 Subject: [PATCH] Make testnet4 magic constant --- src/chain.rs | 9 ++++++++- start | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/chain.rs b/src/chain.rs index ccb2b353..6a23c465 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -57,10 +57,17 @@ pub const LIQUID_TESTNET_PARAMS: address::AddressParams = address::AddressParams blech_hrp: "tlq", }; +/// Magic for testnet4, 0x1c163f28 (from BIP94) with flipped endianness. +#[cfg(not(feature = "liquid"))] +const TESTNET4_MAGIC: u32 = 0x283f161c; + impl Network { #[cfg(not(feature = "liquid"))] pub fn magic(self) -> u32 { - BNetwork::from(self).magic() + match self { + Self::Testnet4 => TESTNET4_MAGIC, + _ => BNetwork::from(self).magic(), + } } #[cfg(feature = "liquid")] diff --git a/start b/start index 7e5cd80f..8f31d39f 100755 --- a/start +++ b/start @@ -45,7 +45,6 @@ case "${1}" in ;; testnet4) NETWORK=testnet4 - MAGIC=283f161c THREADS=$((NPROC / 6)) ;; signet) @@ -157,7 +156,6 @@ do --precache-threads "${THREADS}" \ --cookie "${RPC_USER}:${RPC_PASS}" \ --cors '*' \ - --magic "${MAGIC}" \ --address-search \ --utxos-limit "${UTXOS_LIMIT}" \ --electrum-txs-limit "${ELECTRUM_TXS_LIMIT}" \