diff --git a/src/chain.rs b/src/chain.rs index 8abf9a4a..ccb2b353 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -128,7 +128,7 @@ impl Network { pub fn genesis_hash(network: Network) -> BlockHash { #[cfg(not(feature = "liquid"))] - return bitcoin_genesis_hash(network.into()); + return bitcoin_genesis_hash(network); #[cfg(feature = "liquid")] return liquid_genesis_hash(network); } @@ -139,13 +139,16 @@ pub fn bitcoin_genesis_hash(network: Network) -> bitcoin::BlockHash { genesis_block(BNetwork::Bitcoin).block_hash(); static ref TESTNET_GENESIS: bitcoin::BlockHash = genesis_block(BNetwork::Testnet).block_hash(); - static ref TESTNET4_GENESIS: bitcoin::BlockHash = - BlockHash::from_str("00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043").unwrap(); + static ref TESTNET4_GENESIS: bitcoin::BlockHash = bitcoin::BlockHash::from_str( + "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043" + ) + .unwrap(); static ref REGTEST_GENESIS: bitcoin::BlockHash = genesis_block(BNetwork::Regtest).block_hash(); static ref SIGNET_GENESIS: bitcoin::BlockHash = genesis_block(BNetwork::Signet).block_hash(); } + #[cfg(not(feature = "liquid"))] match network { Network::Bitcoin => *BITCOIN_GENESIS, Network::Testnet => *TESTNET_GENESIS, @@ -153,6 +156,12 @@ pub fn bitcoin_genesis_hash(network: Network) -> bitcoin::BlockHash { Network::Regtest => *REGTEST_GENESIS, Network::Signet => *SIGNET_GENESIS, } + #[cfg(feature = "liquid")] + match network { + Network::Liquid => *BITCOIN_GENESIS, + Network::LiquidTestnet => *TESTNET_GENESIS, + Network::LiquidRegtest => *REGTEST_GENESIS, + } } #[cfg(feature = "liquid")] diff --git a/src/daemon.rs b/src/daemon.rs index b8bde690..f04045d0 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -295,6 +295,7 @@ pub struct Daemon { } impl Daemon { + #[allow(clippy::too_many_arguments)] pub fn new( daemon_dir: PathBuf, blocks_dir: PathBuf, diff --git a/src/elements/peg.rs b/src/elements/peg.rs index cd339e60..7956973f 100644 --- a/src/elements/peg.rs +++ b/src/elements/peg.rs @@ -19,7 +19,13 @@ pub fn get_pegout_data( let pegged_asset_id = network.pegged_asset()?; txout.pegout_data().filter(|pegout| { pegout.asset == Asset::Explicit(*pegged_asset_id) - && pegout.genesis_hash == bitcoin_genesis_hash(parent_network) + && pegout.genesis_hash + == bitcoin_genesis_hash(match parent_network { + BNetwork::Bitcoin => Network::Liquid, + BNetwork::Testnet => Network::LiquidTestnet, + BNetwork::Signet => return false, + BNetwork::Regtest => Network::LiquidRegtest, + }) }) } diff --git a/src/rest.rs b/src/rest.rs index 2e061b11..ce8bef96 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -1668,7 +1668,10 @@ fn address_to_scripthash(addr: &str, network: Network) -> Result