]> Untitled Git - bdk/commitdiff
Added a wallet unit test to send to a Bech32m address
authorSandipan Dey <hey@sandipan.dev>
Mon, 13 Sep 2021 16:29:20 +0000 (21:59 +0530)
committerSteve Myers <steve@notmandatory.org>
Thu, 11 Nov 2021 16:20:38 +0000 (08:20 -0800)
Cargo.toml
src/blockchain/rpc.rs
src/wallet/mod.rs

index b289f1949e1c5f6c05610b4d69464e4adb37b434..701960d01dccc21ce4488c41fb7a789c206e2236 100644 (file)
@@ -90,6 +90,10 @@ test-rpc = ["rpc", "electrsd/electrs_0_8_10", "test-blockchains"]
 test-esplora = ["electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"]
 test-md-docs = ["electrum"]
 
+[patch.crates-io]
+core-rpc = { git="https://github.com/sandipndev/rust-bitcoincore-rpc", branch="bech32m-support" }
+bitcoind = { git="https://github.com/sandipndev/bitcoind", branch="create-wallet-updates" }
+
 [dev-dependencies]
 lazy_static = "1.4"
 env_logger = "0.7"
index 4cd22943d973657fd52a96871f82925743273121..d1706b6ff6fbeb723f1e5b86739e98d18b280464 100644 (file)
@@ -370,7 +370,7 @@ impl ConfigurableBlockchain for RpcBlockchain {
                 client.load_wallet(&wallet_name)?;
                 debug!("wallet loaded {:?}", wallet_name);
             } else {
-                client.create_wallet(&wallet_name, Some(true), None, None, None)?;
+                client.create_wallet(&wallet_name, Some(true), None, None, None, None)?;
                 debug!("wallet created {:?}", wallet_name);
             }
         }
@@ -445,7 +445,7 @@ where
 }
 
 /// return the wallets available in default wallet directory
-//TODO use bitcoincore_rpc method when PR #179 lands
+//TODO use core_rpc method when PR #179 lands
 fn list_wallet_dir(client: &Client) -> Result<Vec<String>, Error> {
     #[derive(Deserialize)]
     struct Name {
index d5a6cb30e2a011077b6edd0edd3f5d7abdb49217..832626e3102b0bed1c797d018b32deac87b55109 100644 (file)
@@ -3994,4 +3994,15 @@ pub(crate) mod test {
             }
         );
     }
+
+    #[test]
+    fn test_sending_to_bip350_bech32m_address() {
+        let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
+        let addr =
+            Address::from_str("tb1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesf3hn0c")
+                .unwrap();
+        let mut builder = wallet.build_tx();
+        builder.add_recipient(addr.script_pubkey(), 45_000);
+        builder.finish().unwrap();
+    }
 }