Skip to content

Commit 4c71c02

Browse files
committed
Merge #247: Implement backupwallet method and test
8c14cd0 Implement backupwallet method and test (GideonBature) Pull request description: The JSON-RPC method `backupwallet` does return null. 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: tcharding: ACK 8c14cd0 Tree-SHA512: ee68c57b2e8be5c10408b7e21f05d477429d20bcd6a6e4758a933f6607f277f6d4cca825885cca1780524761ffe89c2ad64866bee76d5b934f27807efc0f2626
2 parents 4e9ad52 + 8c14cd0 commit 4c71c02

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
@@ -112,6 +112,7 @@ crate::impl_client_v17__verify_message!();
112112
crate::impl_client_v17__abandon_transaction!();
113113
crate::impl_client_v17__abort_rescan!();
114114
crate::impl_client_v17__add_multisig_address!();
115+
crate::impl_client_v17__backup_wallet!();
115116
crate::impl_client_v17__bump_fee!();
116117
crate::impl_client_v17__create_wallet!();
117118
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v17/wallet.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ macro_rules! impl_client_v17__add_multisig_address {
5959
};
6060
}
6161

62+
/// Implements Bitcoin Core JSON-RPC API method `bumpfee`.
63+
#[macro_export]
64+
macro_rules! impl_client_v17__backup_wallet {
65+
() => {
66+
impl Client {
67+
pub fn backup_wallet(&self, destination: &Path) -> Result<()> {
68+
match self.call("backupwallet", &[into_json(destination)?]) {
69+
Ok(serde_json::Value::Null) => Ok(()),
70+
Ok(res) => Err(Error::Returned(res.to_string())),
71+
Err(err) => Err(err.into()),
72+
}
73+
}
74+
}
75+
};
76+
}
77+
6278
/// Implements Bitcoin Core JSON-RPC API method `bumpfee`.
6379
#[macro_export]
6480
macro_rules! impl_client_v17__bump_fee {

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ crate::impl_client_v17__verify_message!();
126126
crate::impl_client_v17__abandon_transaction!();
127127
crate::impl_client_v17__abort_rescan!();
128128
crate::impl_client_v17__add_multisig_address!();
129+
crate::impl_client_v17__backup_wallet!();
129130
crate::impl_client_v17__bump_fee!();
130131
crate::impl_client_v17__create_wallet!();
131132
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ crate::impl_client_v17__verify_message!();
121121
crate::impl_client_v17__abandon_transaction!();
122122
crate::impl_client_v17__abort_rescan!();
123123
crate::impl_client_v17__add_multisig_address!();
124+
crate::impl_client_v17__backup_wallet!();
124125
crate::impl_client_v17__bump_fee!();
125126
crate::impl_client_v17__create_wallet!();
126127
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ crate::impl_client_v17__verify_message!();
118118
crate::impl_client_v17__abandon_transaction!();
119119
crate::impl_client_v17__abort_rescan!();
120120
crate::impl_client_v17__add_multisig_address!();
121+
crate::impl_client_v17__backup_wallet!();
121122
crate::impl_client_v17__bump_fee!();
122123
crate::impl_client_v17__create_wallet!();
123124
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ crate::impl_client_v17__verify_message!();
120120
crate::impl_client_v17__abandon_transaction!();
121121
crate::impl_client_v17__abort_rescan!();
122122
crate::impl_client_v17__add_multisig_address!();
123+
crate::impl_client_v17__backup_wallet!();
123124
crate::impl_client_v17__bump_fee!();
124125
crate::impl_client_v17__create_wallet!();
125126
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ crate::impl_client_v17__verify_message!();
120120
crate::impl_client_v17__abandon_transaction!();
121121
crate::impl_client_v17__abort_rescan!();
122122
crate::impl_client_v17__add_multisig_address!();
123+
crate::impl_client_v17__backup_wallet!();
123124
crate::impl_client_v17__bump_fee!();
124125
crate::impl_client_v17__create_wallet!();
125126
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ crate::impl_client_v17__verify_message!();
122122
crate::impl_client_v17__abandon_transaction!();
123123
crate::impl_client_v17__abort_rescan!();
124124
crate::impl_client_v17__add_multisig_address!();
125+
crate::impl_client_v17__backup_wallet!();
125126
crate::impl_client_v17__bump_fee!();
126127
crate::impl_client_v23__create_wallet!();
127128
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ crate::impl_client_v17__verify_message!();
119119
crate::impl_client_v17__abandon_transaction!();
120120
crate::impl_client_v17__abort_rescan!();
121121
crate::impl_client_v17__add_multisig_address!();
122+
crate::impl_client_v17__backup_wallet!();
122123
crate::impl_client_v17__bump_fee!();
123124
crate::impl_client_v23__create_wallet!();
124125
crate::impl_client_v17__dump_priv_key!();

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ crate::impl_client_v17__verify_message!();
119119
crate::impl_client_v17__abandon_transaction!();
120120
crate::impl_client_v17__abort_rescan!();
121121
crate::impl_client_v17__add_multisig_address!();
122+
crate::impl_client_v17__backup_wallet!();
122123
crate::impl_client_v17__bump_fee!();
123124
crate::impl_client_v23__create_wallet!();
124125
crate::impl_client_v17__dump_priv_key!();

0 commit comments

Comments
 (0)