Skip to content

Commit 178a131

Browse files
committed
Merge #287: Implement walletpassphrase method and test
86b06c5 Implement walletpassphrase method and test (GideonBature) Pull request description: The JSON-RPC method `walletpassphrase` does not return anything. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 86b06c5 tcharding: ACK 86b06c5 Tree-SHA512: 54a44b8084ec3a5395e1cbf175a56aaa143b9ff97396b491159ee703497ac956ff8b8726d400cecf472d0ff87f0cc31365529856e6b9e24ad66e3a3c514bd524
2 parents 88c69b3 + 86b06c5 commit 178a131

File tree

15 files changed

+40
-0
lines changed

15 files changed

+40
-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!();
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,22 @@ macro_rules! impl_client_v17__unload_wallet {
666666
};
667667
}
668668

669+
/// Implements Bitcoin Core JSON-RPC API method `walletpassphrase`
670+
#[macro_export]
671+
macro_rules! impl_client_v17__wallet_passphrase {
672+
() => {
673+
impl Client {
674+
pub fn wallet_passphrase(&self, passphrase: &str, timeout: u64) -> Result<()> {
675+
match self.call("walletpassphrase", &[passphrase.into(), timeout.into()]) {
676+
Ok(serde_json::Value::Null) => Ok(()),
677+
Ok(res) => Err(Error::Returned(res.to_string())),
678+
Err(err) => Err(err.into()),
679+
}
680+
}
681+
}
682+
};
683+
}
684+
669685
/// Implements Bitcoin Core JSON-RPC API method `walletcreatefundedpsbt`.
670686
#[macro_export]
671687
macro_rules! impl_client_v17__wallet_create_funded_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!();
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!();
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!();
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
@@ -179,6 +179,7 @@ crate::impl_client_v21__unload_wallet!();
179179
crate::impl_client_v21__upgrade_wallet!();
180180
crate::impl_client_v17__wallet_create_funded_psbt!();
181181
crate::impl_client_v17__wallet_lock!();
182+
crate::impl_client_v17__wallet_passphrase!();
182183
crate::impl_client_v17__wallet_process_psbt!();
183184

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

184185
/// 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
@@ -176,4 +176,5 @@ crate::impl_client_v21__unload_wallet!();
176176
crate::impl_client_v21__upgrade_wallet!();
177177
crate::impl_client_v17__wallet_create_funded_psbt!();
178178
crate::impl_client_v17__wallet_lock!();
179+
crate::impl_client_v17__wallet_passphrase!();
179180
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
@@ -178,4 +178,5 @@ crate::impl_client_v21__unload_wallet!();
178178
crate::impl_client_v21__upgrade_wallet!();
179179
crate::impl_client_v17__wallet_create_funded_psbt!();
180180
crate::impl_client_v17__wallet_lock!();
181+
crate::impl_client_v17__wallet_passphrase!();
181182
crate::impl_client_v17__wallet_process_psbt!();

0 commit comments

Comments
 (0)