Add `start_height` parameter to `bitcoind_rpc::FilterIter::new`
From evanlinjin's comment on bdk_wallet#368:
bitcoind_rpc::Emitter::new has a start_height parameter. This is used in the case the closest block that connects is below the start_height. So if the tip is reorged out, and we only have tip + genesis, we will start from start_height instead. To convey the wallet birthday with the checkpoint tip, while still taking into account reorgs, we can use tip_height - FINAL_DEPTH as the start_height parameter. FINAL_DEPTH can be as conservative as you want.
bitcoind_rpc::FilterIter::new does not have such a parameter. We can add it?
Then we provide docs as how to convey the wallet's birthday to the chain source using the checkpoint tip.
Hey @luisschwab , I would like to work on this issue can you please assign this issue to me ? Thanks!
Hi @luisschwab, I started working on this issue and have opened PR #2205 implementing "start_height" support for "FilterIter". Would appreciate any feedback/review. Thanks!
I don't think this should be part of the bdk_chain 0.24 release milestone since it's on it's own separate track. This change is not required for bdk_chain 0.24 to function properly and it should not hold up the release.
Closing as not planned. As I explained when closing #2205, start_height matters for Emitter because it has to fetch and scan every transaction of every block, so skipping blocks below the wallet birthday saves real work. FilterIter only checks each block's BIP158 filter and fetches a block when the filter matches, so skipping filters below the birthday saves little. Also, the checkpoint tip already tells FilterIter where to start scanning. The reorg handling in my original comment only described how Emitter behaves when a reorg goes below start_height. It was never a reason to add the parameter here.
Thanks @luisschwab for writing this up, and @kafeelraza for taking a shot at it.