]> Untitled Git - bdk/commit
feat(rpc)!: `FilterIter` API redesign
authorvalued mammal <valuedmammal@protonmail.com>
Thu, 24 Jul 2025 18:16:31 +0000 (14:16 -0400)
committervalued mammal <valuedmammal@protonmail.com>
Mon, 1 Sep 2025 16:31:20 +0000 (12:31 -0400)
commit2181c4babf94e541ca695103619ef8eecfb731d2
tree52e2c06e260057fdcae0d66bff4b42f91a3a3199
parent993ae06f374ef5a3f38b723c5dbbfed71800eb85
feat(rpc)!: `FilterIter` API redesign

The API now consists of the methods `new` and `next`.

The local checkpoint and SPK inventory are provided to
the constructor. `next` is now responsible for locating
the point of agreement.

The next filter to fetch is determined by the `next_block_hash`
field of `GetBlockHeaderResult`. If the next header has negative
confirmations due to a reorg, we rewind the internal state until
we find a header still in the best chain.

`Event` is changed to a simple struct containing `cp` and optional
`block`. The checkpoint is updated on each iteration whether
or not it corresponds to a matching block. We use
`CheckPoint::insert` which will also purge evicted blocks
if needed.

Change implementation of `find_base` to use `get_block_header_info`
which helps to reduce the number of RPC calls.

Removed `EventInner`.

Add test `event_checkpoint_connects_to_local_chain` to check
the expected events after a reorg, and check that intermediate
updates can be applied to the local chain.

Co-authored-by: Musab1258 <habeebmusab@gmail.com>
Co-authored-by: Wei Chen <wzc110@gmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
crates/bitcoind_rpc/examples/filter_iter.rs
crates/bitcoind_rpc/src/bip158.rs
crates/bitcoind_rpc/tests/test_filter_iter.rs