diff --git a/src/test/utils.rs b/src/test/utils.rs index df08a4cab..f4782312b 100644 --- a/src/test/utils.rs +++ b/src/test/utils.rs @@ -9,8 +9,8 @@ use bitcoin::{Address, Amount, Network, OutPoint, Txid}; use bitcoind::bitcoincore_rpc::RpcApi; use electrsd::bitcoind::bitcoincore_rpc::bitcoincore_rpc_json::AddressType; -use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD}; use electrsd::electrum_client::ElectrumApi; +use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD}; use regex; @@ -238,6 +238,8 @@ pub fn generate_blocks_and_wait(bitcoind: &BitcoinD, electrsd: &ElectrsD, num: u let address = bitcoind .client .get_new_address(Some("test"), Some(AddressType::Legacy)) + .expect("failed to get new address") + .require_network(Network::Regtest) .expect("failed to get new address"); // TODO: expect this Result once the WouldBlock issue is resolved upstream. let _block_hashes_res = bitcoind.client.generate_to_address(num as u64, &address); diff --git a/src/uniffi_types.rs b/src/uniffi_types.rs index 2b4c02b8b..964571c7f 100644 --- a/src/uniffi_types.rs +++ b/src/uniffi_types.rs @@ -42,7 +42,7 @@ impl UniffiCustomTypeConverter for Address { fn into_custom(val: Self::Builtin) -> uniffi::Result { if let Ok(addr) = Address::from_str(&val) { - return Ok(addr); + return Ok(addr.assume_checked()); } Err(Error::InvalidAddress.into()) diff --git a/tests/common.rs b/tests/common.rs index 6c92c4c1d..6536a312a 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -125,6 +125,8 @@ pub(crate) fn generate_blocks_and_wait( let cur_height = bitcoind.get_block_count().expect("failed to get current block height"); let address = bitcoind .get_new_address(Some("test"), Some(AddressType::Legacy)) + .expect("failed to get new address") + .require_network(Network::Regtest) .expect("failed to get new address"); // TODO: expect this Result once the WouldBlock issue is resolved upstream. let _block_hashes_res = bitcoind.generate_to_address(num as u64, &address);