Skip to content

chain: SyncRequestBuilderExt/FullScanRequestBuilderExt only work with BlockHash checkpoint data #2437

Open

Description

@bhuvan-somisetty

Describe the enhancement
SyncRequestBuilderExt and FullScanRequestBuilderExt (in bdk_chain::indexer::keychain_txout) are only implemented for builders whose checkpoint data is the default D = BlockHash:

impl<K: Clone + Ord + Debug> SyncRequestBuilderExt<K> for SyncRequestBuilder<(K, u32)> { .. }
impl<K: Clone + Ord + Debug> FullScanRequestBuilderExt<K> for FullScanRequestBuilder<K> { .. }

SyncRequestBuilder<I, D>, FullScanRequestBuilder<K, D>, CheckPoint<D> and LocalChain<D> are all generic over D, but with any other D (e.g. Header) revealed_spks_from_indexer, unused_spks_from_indexer and spks_from_indexer cannot be called:

let tip = CheckPoint::<Header>::new(0, genesis_block(Network::Regtest).header);
let request = SyncRequest::builder_at(0)
    .chain_tip(tip)
    .revealed_spks_from_indexer(&indexer, ..) // error[E0599]: method not found
    .build();

The impls never use the checkpoint data, so they can be made generic over D.

Use case
Building sync/full-scan requests from a KeychainTxOutIndex for a LocalChain<Header> (or any custom checkpoint data), the same way it already works for LocalChain<BlockHash>. This is the same kind of D restriction that #2416 fixed for SyncResponse::is_empty/FullScanResponse::is_empty.

Impact

  • Blocking production usage
  • Nice-to-have / UX improvement
  • Developer experience / maintainability

Are you using BDK in a production project?

  • Yes
  • No
  • Not yet, but planning to

Which backend(s) are relevant (if any)?

  • Electrum
  • Esplora
  • Bitcoin Core RPC
  • None / not backend-related (e.g. bdk_chain, bdk_core)
  • Other (please specify): ____

Project or organization (optional)

Additional context
Fix: add a D type parameter to both impls. Callers using the default D = BlockHash are unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions