You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unintuitive and undocumented full_scan behavior #2057
Book of BDK has a overview of the expected sync behavior
However full_scan seems to completely ignore the revealed addresses and goes by the gap only. This means that if there is a large gap it will not discover any transactions even though the addresses are already revealed. A sync will discover those transactions, such that for a "full scan" one has to do full_scanandsync .
onchain wallets can have multiple instances running, that reveal and use scripts. That means that the wallet always has to sync at least the gap limit ahead to discover txs that other instances used.
What to do about it?
Was this behavior intended?
But then to do a full scan, one has to hit the server twice... --> inefficient
changed the title [-]Unintuitive and undocumented `sync` and `full_scan` behavior[/-][+]Unintuitive and undocumented `full_scan` behavior[/+]on Oct 5, 2025
To avoid further confusion I want to propose that we eliminate full-scan and consolidate the sync and full-scan logic into a single sync workflow that keeps the existing sync behavior while making use of the stop-gap functionality.
I think the current behavior is working as intended — full_scan does keychain discovery using the stop gap, and sync checks known scripts. These are separate operations with different purposes.
That said, the issue is valid: callers shouldn't need to call both full_scan and sync to ensure all revealed scripts are checked during discovery. The fix is straightforward — give full_scan awareness of the last revealed index so the stop gap only applies beyond that point. This way full_scan always covers 0..=last_revealed and then continues discovery until the stop gap is hit.
I don't think we should unify full_scan and sync into a single API. They have fundamentally different inputs and use cases:
full_scan takes keychains and a stop gap — it's for discovery
sync takes explicit lists of scripts/txids/outpoints — it's for checking known items
Merging them adds API complexity without adding capability. Callers that only need one (e.g. sync for routine polling, full_scan for wallet restoration) would be forced to interact with a larger API surface.
The targeted fix is to add a last_revealed_by_keychain parameter (or derive it from the indexer) so full_scan knows the minimum range to cover before applying the stop gap.
Activity
[-]Unintuitive and undocumented `sync` and `full_scan` behavior[/-][+]Unintuitive and undocumented `full_scan` behavior[/+]ValuedMammal commentedon Oct 6, 2025
To avoid further confusion I want to propose that we eliminate full-scan and consolidate the sync and full-scan logic into a single sync workflow that keeps the existing sync behavior while making use of the stop-gap functionality.
oleonardolima commentedon Oct 8, 2025
I've moved this issue to bitcoindevkit/bdk, as it applies to
bdk_electrum/esploraand not therust-electrum-client.evanlinjin commentedon Apr 17, 2026
I think the current behavior is working as intended —
full_scandoes keychain discovery using the stop gap, andsyncchecks known scripts. These are separate operations with different purposes.That said, the issue is valid: callers shouldn't need to call both
full_scanandsyncto ensure all revealed scripts are checked during discovery. The fix is straightforward — givefull_scanawareness of the last revealed index so the stop gap only applies beyond that point. This wayfull_scanalways covers0..=last_revealedand then continues discovery until the stop gap is hit.I don't think we should unify
full_scanandsyncinto a single API. They have fundamentally different inputs and use cases:full_scantakes keychains and a stop gap — it's for discoverysynctakes explicit lists of scripts/txids/outpoints — it's for checking known itemsMerging them adds API complexity without adding capability. Callers that only need one (e.g.
syncfor routine polling,full_scanfor wallet restoration) would be forced to interact with a larger API surface.The targeted fix is to add a
last_revealed_by_keychainparameter (or derive it from the indexer) sofull_scanknows the minimum range to cover before applying the stop gap.andreasgriffin commentedon Apr 17, 2026
would work for me :-)
Merge bitcoindevkit#2182: fix: full_scan covers revealed range before…
Merge #2222: fix(core,chain,electrum,esplora): backport #2182