Skip to content

feat(wallet): maintain derived-account rolling lookahead#93

Open
ben-kaufman wants to merge 2 commits into
codex/derived-account-lifecycle-parityfrom
codex/derived-account-rolling-lookahead
Open

feat(wallet): maintain derived-account rolling lookahead#93
ben-kaufman wants to merge 2 commits into
codex/derived-account-lifecycle-parityfrom
codex/derived-account-rolling-lookahead

Conversation

@ben-kaufman

@ben-kaufman ben-kaufman commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • maintain a rolling external receive-script lookahead for derived on-chain accounts after their initial full scan
  • use Electrum's configured additional-wallet stop gap as the lookahead and its configured batch size for derived-account incremental scans
  • scale the Electrum timeout for the larger derived-account incremental request
  • preserve the existing primary and account-0 sync behavior and expose no new public API
  • bump the fork to 0.7.0-rc.56 and regenerate the native binding artifacts

Motivation

An exported xpub may issue receive addresses independently of the node. After the initial full scan, incremental sync previously covered only scripts already revealed to BDK, so later activity at a higher remote-derived index could remain undiscovered until the account was reconstructed.

Derived accounts now scan a rolling window beyond their highest revealed receive index. Activity inside that window advances and replenishes it without revealing unused addresses. reveal_receive_addresses_to_account remains available when an external issuer may skip beyond the current lookahead.

Stacking

This PR is stacked on #92 (codex/derived-account-lifecycle-parity). It should be retargeted to main after #92 merges.

Verification

  • cargo fmt --check
  • git diff --check
  • cargo test --offline -p bdk-wallet-aggregate (38 passed)
  • cargo clippy --offline -p bdk-wallet-aggregate --all-targets -- -D warnings
  • cargo test --offline --lib (75 passed)
  • cargo test --offline --features uniffi --lib (85 passed)
  • cargo check --offline --all-targets --all-features
  • native and UniFFI Electrum rolling-lookahead integration tests
  • configured-account Electrum restart/full-scan integration test
  • ./bindgen.sh, including JVM build, Android Maven-local publish, native-symbol checks, and 16 KiB alignment checks
  • generated JVM/Android/Python whitespace normalization run twice; generated language APIs are unchanged from the base
  • Swift XCFramework checksum verified against Package.swift: 91a31d12acc142ffaa405f4cae8eda0a414f71cf3bd0c4ef26b420a741483617

cargo test --offline --doc passes 11 of 12 doctests. The unchanged Node::list_payments_with_filter example fails at runtime with WalletSetupFailed; this is inherited from the #92 base and is outside this PR's diff.

Release

@ben-kaufman ben-kaufman force-pushed the codex/derived-account-rolling-lookahead branch from 054698f to b8c959c Compare July 15, 2026 11:12
@ben-kaufman ben-kaufman marked this pull request as ready for review July 15, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant