Skip to content

Commit 22acb26

Browse files
committed
Implement walletlock method and test
1 parent c633a03 commit 22acb26

File tree

15 files changed

+39
-0
lines changed

15 files changed

+39
-0
lines changed

client/src/client_sync/v17/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ crate::impl_client_v17__sign_message!();
153153
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
154154
crate::impl_client_v17__unload_wallet!();
155155
crate::impl_client_v17__wallet_create_funded_psbt!();
156+
crate::impl_client_v17__wallet_lock!();
156157
crate::impl_client_v17__wallet_process_psbt!();
157158

158159
/// 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
@@ -669,6 +669,22 @@ macro_rules! impl_client_v17__wallet_create_funded_psbt {
669669
};
670670
}
671671

672+
/// Implements Bitcoin Core JSON-RPC API method `walletlock`.
673+
#[macro_export]
674+
macro_rules! impl_client_v17__wallet_lock {
675+
() => {
676+
impl Client {
677+
pub fn wallet_lock(&self) -> Result<()> {
678+
match self.call("walletlock", &[]) {
679+
Ok(serde_json::Value::Null) => Ok(()),
680+
Ok(res) => Err(Error::Returned(res.to_string())),
681+
Err(err) => Err(err.into()),
682+
}
683+
}
684+
}
685+
};
686+
}
687+
672688
/// Implements Bitcoin Core JSON-RPC API method `walletprocesspsbt`.
673689
#[macro_export]
674690
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
@@ -170,4 +170,5 @@ crate::impl_client_v17__sign_message!();
170170
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
171171
crate::impl_client_v17__unload_wallet!();
172172
crate::impl_client_v17__wallet_create_funded_psbt!();
173+
crate::impl_client_v17__wallet_lock!();
173174
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
@@ -167,4 +167,5 @@ crate::impl_client_v17__sign_message!();
167167
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v17__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170+
crate::impl_client_v17__wallet_lock!();
170171
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
@@ -167,4 +167,5 @@ crate::impl_client_v17__sign_message!();
167167
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v17__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170+
crate::impl_client_v17__wallet_lock!();
170171
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
@@ -167,4 +167,5 @@ crate::impl_client_v17__sign_message!();
167167
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!();
170+
crate::impl_client_v17__wallet_lock!();
170171
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
@@ -167,4 +167,5 @@ crate::impl_client_v17__sign_message!();
167167
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!();
170+
crate::impl_client_v17__wallet_lock!();
170171
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
@@ -169,6 +169,7 @@ crate::impl_client_v17__sign_message!();
169169
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
170170
crate::impl_client_v21__unload_wallet!();
171171
crate::impl_client_v17__wallet_create_funded_psbt!();
172+
crate::impl_client_v17__wallet_lock!();
172173
crate::impl_client_v17__wallet_process_psbt!();
173174

174175
/// 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
@@ -166,4 +166,5 @@ crate::impl_client_v17__sign_message!();
166166
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
167167
crate::impl_client_v21__unload_wallet!();
168168
crate::impl_client_v17__wallet_create_funded_psbt!();
169+
crate::impl_client_v17__wallet_lock!();
169170
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
@@ -166,4 +166,5 @@ crate::impl_client_v17__sign_message!();
166166
crate::impl_client_v17__sign_raw_transaction_with_wallet!();
167167
crate::impl_client_v21__unload_wallet!();
168168
crate::impl_client_v17__wallet_create_funded_psbt!();
169+
crate::impl_client_v17__wallet_lock!();
169170
crate::impl_client_v17__wallet_process_psbt!();

0 commit comments

Comments
 (0)