Skip to content

Commit 085ff1c

Browse files
committed
Add the descriptor argument to createwallet()
Based on rust-bitcoin/rust-bitcoincore-rpc#278
1 parent 953bf61 commit 085ff1c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

client/src/client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,19 @@ pub trait RpcApi: Sized {
282282
blank: Option<bool>,
283283
passphrase: Option<&str>,
284284
avoid_reuse: Option<bool>,
285+
descriptors: Option<bool>,
285286
) -> Result<json::LoadWalletResult> {
286287
let mut args = [
287288
wallet.into(),
288289
opt_into_json(disable_private_keys)?,
289290
opt_into_json(blank)?,
290291
opt_into_json(passphrase)?,
291292
opt_into_json(avoid_reuse)?,
293+
opt_into_json(descriptors)?,
292294
];
293295
self.call(
294296
"createwallet",
295-
handle_defaults(&mut args, &[false.into(), false.into(), into_json("")?, false.into()]),
297+
handle_defaults(&mut args, &[false.into(), false.into(), into_json("")?, false.into(), false.into()]),
296298
)
297299
}
298300

integration_test/src/main.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn main() {
142142
unsafe { VERSION = cl.version().unwrap() };
143143
println!("Version: {}", version());
144144

145-
cl.create_wallet("testwallet", None, None, None, None).unwrap();
145+
cl.create_wallet("testwallet", None, None, None, None, None).unwrap();
146146

147147
test_get_mining_info(&cl);
148148
test_get_blockchain_info(&cl);
@@ -1108,6 +1108,7 @@ fn test_create_wallet(cl: &Client) {
11081108
blank: Option<bool>,
11091109
passphrase: Option<&'a str>,
11101110
avoid_reuse: Option<bool>,
1111+
descriptor: Option<bool>,
11111112
}
11121113

11131114
let mut wallet_params = vec![
@@ -1117,20 +1118,23 @@ fn test_create_wallet(cl: &Client) {
11171118
blank: None,
11181119
passphrase: None,
11191120
avoid_reuse: None,
1121+
descriptor: None,
11201122
},
11211123
WalletParams {
11221124
name: wallet_names[1],
11231125
disable_private_keys: Some(true),
11241126
blank: None,
11251127
passphrase: None,
11261128
avoid_reuse: None,
1129+
descriptor: None,
11271130
},
11281131
WalletParams {
11291132
name: wallet_names[2],
11301133
disable_private_keys: None,
11311134
blank: Some(true),
11321135
passphrase: None,
11331136
avoid_reuse: None,
1137+
descriptor: None,
11341138
},
11351139
];
11361140

@@ -1141,13 +1145,15 @@ fn test_create_wallet(cl: &Client) {
11411145
blank: None,
11421146
passphrase: Some("pass"),
11431147
avoid_reuse: None,
1148+
descriptor: None,
11441149
});
11451150
wallet_params.push(WalletParams {
11461151
name: wallet_names[4],
11471152
disable_private_keys: None,
11481153
blank: None,
11491154
passphrase: None,
11501155
avoid_reuse: Some(true),
1156+
descriptor: Some(false),
11511157
});
11521158
}
11531159

@@ -1159,6 +1165,7 @@ fn test_create_wallet(cl: &Client) {
11591165
wallet_param.blank,
11601166
wallet_param.passphrase,
11611167
wallet_param.avoid_reuse,
1168+
wallet_param.descriptor,
11621169
)
11631170
.unwrap();
11641171

@@ -1314,7 +1321,7 @@ fn test_getblocktemplate(cl: &Client) {
13141321
}
13151322

13161323
fn test_unloadwallet(cl: &Client) {
1317-
cl.create_wallet("testunloadwallet", None, None, None, None).unwrap();
1324+
cl.create_wallet("testunloadwallet", None, None, None, None, None).unwrap();
13181325

13191326
let res = new_wallet_client("testunloadwallet")
13201327
.unload_wallet(None)
@@ -1332,7 +1339,7 @@ fn test_loadwallet(_: &Client) {
13321339
let wallet_client = new_wallet_client(wallet_name);
13331340

13341341
assert!(wallet_client.load_wallet(wallet_name).is_err());
1335-
wallet_client.create_wallet(wallet_name, None, None, None, None).unwrap();
1342+
wallet_client.create_wallet(wallet_name, None, None, None, None, None).unwrap();
13361343
assert!(wallet_client.load_wallet(wallet_name).is_err());
13371344
wallet_client.unload_wallet(None).unwrap();
13381345

@@ -1347,7 +1354,7 @@ fn test_backupwallet(_: &Client) {
13471354

13481355
assert!(wallet_client.backup_wallet(None).is_err());
13491356
assert!(wallet_client.backup_wallet(Some(&backup_path)).is_err());
1350-
wallet_client.create_wallet("testbackupwallet", None, None, None, None).unwrap();
1357+
wallet_client.create_wallet("testbackupwallet", None, None, None, None, None).unwrap();
13511358
assert!(wallet_client.backup_wallet(None).is_err());
13521359
assert!(wallet_client.backup_wallet(Some(&backup_path)).is_ok());
13531360
}

0 commit comments

Comments
 (0)