Skip to content

Commit 7588cfa

Browse files
committed
Implement walletpassphrasechange method and test
1 parent 6875709 commit 7588cfa

File tree

15 files changed

+46
-0
lines changed

15 files changed

+46
-0
lines changed

client/src/client_sync/v17/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
155155
crate::impl_client_v17__unload_wallet!();
156156
crate::impl_client_v17__wallet_create_funded_psbt!();
157157
crate::impl_client_v17__wallet_lock!();
158+
crate::impl_client_v17__wallet_passphrase_change!();
158159
crate::impl_client_v17__wallet_process_psbt!();
159160

160161
/// Argument to the `Client::get_new_address_with_type` function.

client/src/client_sync/v17/wallet.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,28 @@ macro_rules! impl_client_v17__wallet_lock {
698698
};
699699
}
700700

701+
/// Implements Bitcoin Core JSON-RPC API method `walletpassphrasechange`
702+
#[macro_export]
703+
macro_rules! impl_client_v17__wallet_passphrase_change {
704+
() => {
705+
impl Client {
706+
pub fn wallet_passphrase_change(
707+
&self,
708+
old_passphrase: &str,
709+
new_passphrase: &str,
710+
) -> Result<()> {
711+
match self
712+
.call("walletpassphrasechange", &[old_passphrase.into(), new_passphrase.into()])
713+
{
714+
Ok(serde_json::Value::Null) => Ok(()),
715+
Ok(res) => Err(Error::Returned(res.to_string())),
716+
Err(err) => Err(err.into()),
717+
}
718+
}
719+
}
720+
};
721+
}
722+
701723
/// Implements Bitcoin Core JSON-RPC API method `walletprocesspsbt`.
702724
#[macro_export]
703725
macro_rules! impl_client_v17__wallet_process_psbt {

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
172172
crate::impl_client_v17__unload_wallet!();
173173
crate::impl_client_v17__wallet_create_funded_psbt!();
174174
crate::impl_client_v17__wallet_lock!();
175+
crate::impl_client_v17__wallet_passphrase_change!();
175176
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase_change!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase_change!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v21__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase_change!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v21__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase_change!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
171171
crate::impl_client_v21__unload_wallet!();
172172
crate::impl_client_v17__wallet_create_funded_psbt!();
173173
crate::impl_client_v17__wallet_lock!();
174+
crate::impl_client_v17__wallet_passphrase_change!();
174175
crate::impl_client_v17__wallet_process_psbt!();
175176

176177
/// Argument to the `Client::get_new_address_with_type` function.

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v21__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170170
crate::impl_client_v17__wallet_lock!();
171+
crate::impl_client_v17__wallet_passphrase_change!();
171172
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v21__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170170
crate::impl_client_v17__wallet_lock!();
171+
crate::impl_client_v17__wallet_passphrase_change!();
171172
crate::impl_client_v17__wallet_process_psbt!();

0 commit comments

Comments
 (0)