Skip to content

Commit 75f8e9e

Browse files
committed
Implement walletpassphrasechange method and test
1 parent 178a131 commit 75f8e9e

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
@@ -156,6 +156,7 @@ crate::impl_client_v17__unload_wallet!();
156156
crate::impl_client_v17__wallet_create_funded_psbt!();
157157
crate::impl_client_v17__wallet_lock!();
158158
crate::impl_client_v17__wallet_passphrase!();
159+
crate::impl_client_v17__wallet_passphrase_change!();
159160
crate::impl_client_v17__wallet_process_psbt!();
160161

161162
/// 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
@@ -714,6 +714,28 @@ macro_rules! impl_client_v17__wallet_lock {
714714
};
715715
}
716716

717+
/// Implements Bitcoin Core JSON-RPC API method `walletpassphrasechange`
718+
#[macro_export]
719+
macro_rules! impl_client_v17__wallet_passphrase_change {
720+
() => {
721+
impl Client {
722+
pub fn wallet_passphrase_change(
723+
&self,
724+
old_passphrase: &str,
725+
new_passphrase: &str,
726+
) -> Result<()> {
727+
match self
728+
.call("walletpassphrasechange", &[old_passphrase.into(), new_passphrase.into()])
729+
{
730+
Ok(serde_json::Value::Null) => Ok(()),
731+
Ok(res) => Err(Error::Returned(res.to_string())),
732+
Err(err) => Err(err.into()),
733+
}
734+
}
735+
}
736+
};
737+
}
738+
717739
/// Implements Bitcoin Core JSON-RPC API method `walletprocesspsbt`.
718740
#[macro_export]
719741
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
@@ -173,4 +173,5 @@ crate::impl_client_v17__unload_wallet!();
173173
crate::impl_client_v17__wallet_create_funded_psbt!();
174174
crate::impl_client_v17__wallet_lock!();
175175
crate::impl_client_v17__wallet_passphrase!();
176+
crate::impl_client_v17__wallet_passphrase_change!();
176177
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
@@ -170,4 +170,5 @@ crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172172
crate::impl_client_v17__wallet_passphrase!();
173+
crate::impl_client_v17__wallet_passphrase_change!();
173174
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
@@ -170,4 +170,5 @@ crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172172
crate::impl_client_v17__wallet_passphrase!();
173+
crate::impl_client_v17__wallet_passphrase_change!();
173174
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
@@ -180,6 +180,7 @@ crate::impl_client_v21__upgrade_wallet!();
180180
crate::impl_client_v17__wallet_create_funded_psbt!();
181181
crate::impl_client_v17__wallet_lock!();
182182
crate::impl_client_v17__wallet_passphrase!();
183+
crate::impl_client_v17__wallet_passphrase_change!();
183184
crate::impl_client_v17__wallet_process_psbt!();
184185

185186
/// Request object for the `importdescriptors` method.

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,5 @@ crate::impl_client_v21__upgrade_wallet!();
178178
crate::impl_client_v17__wallet_create_funded_psbt!();
179179
crate::impl_client_v17__wallet_lock!();
180180
crate::impl_client_v17__wallet_passphrase!();
181+
crate::impl_client_v17__wallet_passphrase_change!();
181182
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
@@ -180,6 +180,7 @@ crate::impl_client_v21__upgrade_wallet!();
180180
crate::impl_client_v17__wallet_create_funded_psbt!();
181181
crate::impl_client_v17__wallet_lock!();
182182
crate::impl_client_v17__wallet_passphrase!();
183+
crate::impl_client_v17__wallet_passphrase_change!();
183184
crate::impl_client_v17__wallet_process_psbt!();
184185

185186
/// 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
@@ -177,4 +177,5 @@ crate::impl_client_v21__upgrade_wallet!();
177177
crate::impl_client_v17__wallet_create_funded_psbt!();
178178
crate::impl_client_v17__wallet_lock!();
179179
crate::impl_client_v17__wallet_passphrase!();
180+
crate::impl_client_v17__wallet_passphrase_change!();
180181
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
@@ -179,4 +179,5 @@ crate::impl_client_v21__upgrade_wallet!();
179179
crate::impl_client_v17__wallet_create_funded_psbt!();
180180
crate::impl_client_v17__wallet_lock!();
181181
crate::impl_client_v17__wallet_passphrase!();
182+
crate::impl_client_v17__wallet_passphrase_change!();
182183
crate::impl_client_v17__wallet_process_psbt!();

0 commit comments

Comments
 (0)