Skip to content

Commit 23927f3

Browse files
committed
flesh out scanblocks params
1 parent 1e6ee5f commit 23927f3

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

Diff for: client/src/client.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,19 @@ pub trait RpcApi: Sized {
12581258

12591259
fn scan_blocks_blocking(
12601260
&self,
1261-
descriptors: &[json::ScanBlocksRequest],
1261+
request: json::ScanBlocksRequest,
12621262
) -> Result<json::ScanBlocksResult> {
1263-
self.call("scanblocks", &["start".into(), into_json(descriptors)?])
1263+
self.call(
1264+
"scanblocks",
1265+
&[
1266+
"start".into(),
1267+
into_json(request.scanobjects)?,
1268+
into_json(request.start_height)?,
1269+
into_json(request.stop_height)?,
1270+
into_json(request.filtertype)?,
1271+
into_json(request.options)?,
1272+
],
1273+
)
12641274
}
12651275

12661276
fn scan_tx_out_set_blocking(

Diff for: json/src/lib.rs

+24-2
Original file line numberDiff line numberDiff line change
@@ -2087,10 +2087,32 @@ pub enum PubKeyOrAddress<'a> {
20872087
PubKey(&'a PublicKey),
20882088
}
20892089

2090+
#[derive(Serialize, Clone, PartialEq, Eq, Debug)]
2091+
/// Start a scan of the block filter index for an [output descriptor](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md).
2092+
pub struct ScanBlocksRequest<'a> {
2093+
/// List of descriptors to scan
2094+
pub scanobjects: &'a [ScanBlocksRequestDescriptor],
2095+
/// Height at which to start scanning
2096+
pub start_height: Option<u64>,
2097+
/// Height at which to stop scanning
2098+
pub stop_height: Option<u64>,
2099+
/// Filter type. Only "basic" is supported for now.
2100+
pub filtertype: Option<String>,
2101+
/// Additional scan options. Only "filter_false_positives" is supported for now.
2102+
pub options: Option<ScanBlocksOptions>,
2103+
}
2104+
2105+
#[derive(Serialize, Clone, PartialEq, Eq, Debug)]
2106+
/// Options struct for `scanblocks` rpc
2107+
pub struct ScanBlocksOptions {
2108+
/// Scan for a single descriptor
2109+
pub filter_false_positives: Option<bool>,
2110+
}
2111+
20902112
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
20912113
#[serde(untagged)]
2092-
/// Start a scan of the UTXO set for an [output descriptor](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md).
2093-
pub enum ScanBlocksRequest {
2114+
/// Descriptors to scan in `scanblocks` rpc
2115+
pub enum ScanBlocksRequestDescriptor {
20942116
/// Scan for a single descriptor
20952117
Single(String),
20962118
/// Scan for a descriptor with xpubs

0 commit comments

Comments
 (0)