Skip to content

Commit 7f1f956

Browse files
committed
Implement version specific types for keypoolrefill
1 parent c062c91 commit 7f1f956

File tree

14 files changed

+46
-0
lines changed

14 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
@@ -133,6 +133,7 @@ crate::impl_client_v17__importprivkey!();
133133
crate::impl_client_v17__importprunedfunds!();
134134
crate::impl_client_v17__importpubkey!();
135135
crate::impl_client_v17__importwallet!();
136+
crate::impl_client_v17__keypoolrefill!();
136137

137138
/// Argument to the `Client::get_new_address_with_type` function.
138139
///

client/src/client_sync/v17/wallet.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,3 +649,25 @@ macro_rules! impl_client_v17__importwallet {
649649
}
650650
};
651651
}
652+
653+
/// Implements Bitcoin Core JSON-RPC API method `keypoolrefill`
654+
#[macro_export]
655+
macro_rules! impl_client_v17__keypoolrefill {
656+
() => {
657+
impl Client {
658+
pub fn keypool_refill(&self, new_size: Option<usize>) -> Result<()> {
659+
let params = match new_size {
660+
Some(size) => vec![size.into()],
661+
None => vec![],
662+
};
663+
664+
match self.call("keypoolrefill", &params) {
665+
Ok(serde_json::Value::Null) => Ok(()),
666+
Ok(ref val) if val.is_null() => Ok(()),
667+
Ok(other) => Err(crate::client_sync::Error::Returned(format!("keypoolrefill expected null, got: {}", other))),
668+
Err(e) => Err(e.into()),
669+
}
670+
}
671+
}
672+
};
673+
}

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,4 @@ crate::impl_client_v17__importprivkey!();
126126
crate::impl_client_v17__importprunedfunds!();
127127
crate::impl_client_v17__importpubkey!();
128128
crate::impl_client_v17__importwallet!();
129+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ crate::impl_client_v17__importprivkey!();
128128
crate::impl_client_v17__importprunedfunds!();
129129
crate::impl_client_v17__importpubkey!();
130130
crate::impl_client_v17__importwallet!();
131+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,4 @@ crate::impl_client_v17__importprivkey!();
127127
crate::impl_client_v17__importprunedfunds!();
128128
crate::impl_client_v17__importpubkey!();
129129
crate::impl_client_v17__importwallet!();
130+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,4 @@ crate::impl_client_v17__importprivkey!();
127127
crate::impl_client_v17__importprunedfunds!();
128128
crate::impl_client_v17__importpubkey!();
129129
crate::impl_client_v17__importwallet!();
130+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ crate::impl_client_v17__importprivkey!();
128128
crate::impl_client_v17__importprunedfunds!();
129129
crate::impl_client_v17__importpubkey!();
130130
crate::impl_client_v17__importwallet!();
131+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ crate::impl_client_v17__importprivkey!();
129129
crate::impl_client_v17__importprunedfunds!();
130130
crate::impl_client_v17__importpubkey!();
131131
crate::impl_client_v17__importwallet!();
132+
crate::impl_client_v17__keypoolrefill!();
132133

133134
/// Argument to the `Client::get_new_address_with_type` function.
134135
///

client/src/client_sync/v24.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,4 @@ crate::impl_client_v17__importprivkey!();
125125
crate::impl_client_v17__importprunedfunds!();
126126
crate::impl_client_v17__importpubkey!();
127127
crate::impl_client_v17__importwallet!();
128+
crate::impl_client_v17__keypoolrefill!();

client/src/client_sync/v25.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,4 @@ crate::impl_client_v17__importprivkey!();
125125
crate::impl_client_v17__importprunedfunds!();
126126
crate::impl_client_v17__importpubkey!();
127127
crate::impl_client_v17__importwallet!();
128+
crate::impl_client_v17__keypoolrefill!();

0 commit comments

Comments
 (0)