Skip to content

Commit 54f61d1

Browse files
sandipndevnotmandatory
authored andcommitted
Added a wallet unit test to send to a Bech32m address
1 parent 5830226 commit 54f61d1

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ test-rpc = ["rpc", "electrsd/electrs_0_8_10", "test-blockchains"]
9090
test-esplora = ["electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"]
9191
test-md-docs = ["electrum"]
9292

93+
[patch.crates-io]
94+
core-rpc = { git="https://github.com/sandipndev/rust-bitcoincore-rpc", branch="bech32m-support" }
95+
bitcoind = { git="https://github.com/sandipndev/bitcoind", branch="create-wallet-updates" }
96+
9397
[dev-dependencies]
9498
lazy_static = "1.4"
9599
env_logger = "0.7"

src/blockchain/rpc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl ConfigurableBlockchain for RpcBlockchain {
370370
client.load_wallet(&wallet_name)?;
371371
debug!("wallet loaded {:?}", wallet_name);
372372
} else {
373-
client.create_wallet(&wallet_name, Some(true), None, None, None)?;
373+
client.create_wallet(&wallet_name, Some(true), None, None, None, None)?;
374374
debug!("wallet created {:?}", wallet_name);
375375
}
376376
}
@@ -445,7 +445,7 @@ where
445445
}
446446

447447
/// return the wallets available in default wallet directory
448-
//TODO use bitcoincore_rpc method when PR #179 lands
448+
//TODO use core_rpc method when PR #179 lands
449449
fn list_wallet_dir(client: &Client) -> Result<Vec<String>, Error> {
450450
#[derive(Deserialize)]
451451
struct Name {

src/wallet/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3994,4 +3994,15 @@ pub(crate) mod test {
39943994
}
39953995
);
39963996
}
3997+
3998+
#[test]
3999+
fn test_sending_to_bip350_bech32m_address() {
4000+
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
4001+
let addr =
4002+
Address::from_str("tb1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesf3hn0c")
4003+
.unwrap();
4004+
let mut builder = wallet.build_tx();
4005+
builder.add_recipient(addr.script_pubkey(), 45_000);
4006+
builder.finish().unwrap();
4007+
}
39974008
}

0 commit comments

Comments
 (0)