Skip to content

Commit

Permalink
Add the descriptor argument to createwallet()
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Nov 20, 2023
1 parent 953bf61 commit 085ff1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,19 @@ pub trait RpcApi: Sized {
blank: Option<bool>,
passphrase: Option<&str>,
avoid_reuse: Option<bool>,
descriptors: Option<bool>,
) -> Result<json::LoadWalletResult> {
let mut args = [
wallet.into(),
opt_into_json(disable_private_keys)?,
opt_into_json(blank)?,
opt_into_json(passphrase)?,
opt_into_json(avoid_reuse)?,
opt_into_json(descriptors)?,
];
self.call(
"createwallet",
handle_defaults(&mut args, &[false.into(), false.into(), into_json("")?, false.into()]),
handle_defaults(&mut args, &[false.into(), false.into(), into_json("")?, false.into(), false.into()]),
)
}

Expand Down
15 changes: 11 additions & 4 deletions integration_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn main() {
unsafe { VERSION = cl.version().unwrap() };
println!("Version: {}", version());

cl.create_wallet("testwallet", None, None, None, None).unwrap();
cl.create_wallet("testwallet", None, None, None, None, None).unwrap();

test_get_mining_info(&cl);
test_get_blockchain_info(&cl);
Expand Down Expand Up @@ -1108,6 +1108,7 @@ fn test_create_wallet(cl: &Client) {
blank: Option<bool>,
passphrase: Option<&'a str>,
avoid_reuse: Option<bool>,
descriptor: Option<bool>,
}

let mut wallet_params = vec![
Expand All @@ -1117,20 +1118,23 @@ fn test_create_wallet(cl: &Client) {
blank: None,
passphrase: None,
avoid_reuse: None,
descriptor: None,
},
WalletParams {
name: wallet_names[1],
disable_private_keys: Some(true),
blank: None,
passphrase: None,
avoid_reuse: None,
descriptor: None,
},
WalletParams {
name: wallet_names[2],
disable_private_keys: None,
blank: Some(true),
passphrase: None,
avoid_reuse: None,
descriptor: None,
},
];

Expand All @@ -1141,13 +1145,15 @@ fn test_create_wallet(cl: &Client) {
blank: None,
passphrase: Some("pass"),
avoid_reuse: None,
descriptor: None,
});
wallet_params.push(WalletParams {
name: wallet_names[4],
disable_private_keys: None,
blank: None,
passphrase: None,
avoid_reuse: Some(true),
descriptor: Some(false),
});
}

Expand All @@ -1159,6 +1165,7 @@ fn test_create_wallet(cl: &Client) {
wallet_param.blank,
wallet_param.passphrase,
wallet_param.avoid_reuse,
wallet_param.descriptor,
)
.unwrap();

Expand Down Expand Up @@ -1314,7 +1321,7 @@ fn test_getblocktemplate(cl: &Client) {
}

fn test_unloadwallet(cl: &Client) {
cl.create_wallet("testunloadwallet", None, None, None, None).unwrap();
cl.create_wallet("testunloadwallet", None, None, None, None, None).unwrap();

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

assert!(wallet_client.load_wallet(wallet_name).is_err());
wallet_client.create_wallet(wallet_name, None, None, None, None).unwrap();
wallet_client.create_wallet(wallet_name, None, None, None, None, None).unwrap();
assert!(wallet_client.load_wallet(wallet_name).is_err());
wallet_client.unload_wallet(None).unwrap();

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

assert!(wallet_client.backup_wallet(None).is_err());
assert!(wallet_client.backup_wallet(Some(&backup_path)).is_err());
wallet_client.create_wallet("testbackupwallet", None, None, None, None).unwrap();
wallet_client.create_wallet("testbackupwallet", None, None, None, None, None).unwrap();
assert!(wallet_client.backup_wallet(None).is_err());
assert!(wallet_client.backup_wallet(Some(&backup_path)).is_ok());
}
Expand Down

0 comments on commit 085ff1c

Please sign in to comment.