Skip to content

Commit 4b295ee

Browse files
committed
docs(bip158): Update FilterIter documentation
1 parent 2181c4b commit 4b295ee

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

crates/bitcoind_rpc/src/bip158.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,20 @@ use bitcoincore_rpc;
1313
use bitcoincore_rpc::{json::GetBlockHeaderResult, RpcApi};
1414

1515
/// Type that returns Bitcoin blocks by matching a list of script pubkeys (SPKs) against a
16-
/// [`bip158::BlockFilter`].
16+
/// [`bip158::BlockFilter`](bitcoin::bip158::BlockFilter).
17+
///
18+
/// * `FilterIter` talks to bitcoind via JSON-RPC interface, which is handled by the
19+
/// [`bitcoincore_rpc::Client`].
20+
/// * Collect the script pubkeys (SPKs) you want to watch. These will usually correspond to wallet
21+
/// addresses that have been handed out for receiving payments.
22+
/// * Construct `FilterIter` with the RPC client, SPKs, and [`CheckPoint`]. The checkpoint tip
23+
/// informs `FilterIter` of the height to begin scanning from. An error is thrown if `FilterIter`
24+
/// is unable to find a common ancestor with the remote node.
25+
/// * Scan blocks by calling `next` in a loop and processing the [`Event`]s. If a filter matched any
26+
/// of the watched scripts, then the relevant [`Block`] is returned. Note that false positives may
27+
/// occur. `FilterIter` will continue to yield events until it reaches the latest chain tip.
28+
/// Events contain the updated checkpoint `cp` which may be incorporated into the local chain
29+
/// state to stay in sync with the tip.
1730
#[derive(Debug)]
1831
pub struct FilterIter<'a> {
1932
/// RPC client

0 commit comments

Comments
 (0)