Skip to content

Commit 608f53d

Browse files
committed
f Account for Address network types now require checks
1 parent 17441ff commit 608f53d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/test/utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use bitcoin::{Address, Amount, Network, OutPoint, Txid};
99

1010
use bitcoind::bitcoincore_rpc::RpcApi;
1111
use electrsd::bitcoind::bitcoincore_rpc::bitcoincore_rpc_json::AddressType;
12-
use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD};
1312
use electrsd::electrum_client::ElectrumApi;
13+
use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD};
1414

1515
use regex;
1616

@@ -238,6 +238,8 @@ pub fn generate_blocks_and_wait(bitcoind: &BitcoinD, electrsd: &ElectrsD, num: u
238238
let address = bitcoind
239239
.client
240240
.get_new_address(Some("test"), Some(AddressType::Legacy))
241+
.expect("failed to get new address")
242+
.require_network(Network::Regtest)
241243
.expect("failed to get new address");
242244
// TODO: expect this Result once the WouldBlock issue is resolved upstream.
243245
let _block_hashes_res = bitcoind.client.generate_to_address(num as u64, &address);

src/uniffi_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl UniffiCustomTypeConverter for Address {
4242

4343
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
4444
if let Ok(addr) = Address::from_str(&val) {
45-
return Ok(addr);
45+
return Ok(addr.assume_checked());
4646
}
4747

4848
Err(Error::InvalidAddress.into())

0 commit comments

Comments
 (0)