Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

full_scan over RPC ignores --scan-stop-gap: restored wallet silently misses funds at external index >= 25

Aberta
#340 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 3 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
50/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
rust
Domínio
cli

Direção de pesquisa

Read src/handlers/online.rs, especially the RPC branch after the Electrum and Esplora handling, and compare how stop_gap is consumed by each backend. Run the linked regtest reproduction to confirm the external-index failure and inspect the wallet lookahead context described in the issue. Done means RPC scans no longer silently miss these funds, or clearly warn and document the limitation.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug

Environment: bdk-cli 4.0.0 from crates.io (tag v4.0.0, git 5b3cb00, built with --features rpc), bdk_wallet 3.2.0, bdk_chain 0.23.3, bdk_bitcoind_rpc 0.22.0, Bitcoin Core v31.1.0, regtest, macOS arm64

What happens
Restoring a wpkh() descriptor exported from Bitcoin Core and running full_scan with --client-type rpc does not find funds received at external index 25 or higher when no lower index has been used. The command exits with status 0, prints "Full scan completed successfully." and reports a zero balance. Passing --scan-stop-gap 100 does not change the result, even though full_scan --help documents that flag without noting that it has no effect with --client-type rpc.

Funded external index (only) Core getbalance bdk-cli balance
24 1.00000000 100000000 sat
25 1.00000000 0
30 1.00000000 0
30 with --scan-stop-gap 100 1.00000000 0

bdk-cli's own event output shows the chain was fully walked in every case ("Chain tip advanced from height 0 to …"), but a "Transaction … confirmed" event appears only for index 24.

Expected behavior
Either the funds are found when --scan-stop-gap is raised (as the help text suggests), or the CLI warns that the flag has no effect with --client-type rpc.

Why (from reading the v4.0.0 source)
In src/handlers/online.rs, stop_gap is passed to the Electrum (L123) and Esplora (L134) clients, but the RPC branch (L141+) walks blocks with Emitter and never reads it. Detection then depends on the keychain lookahead (DEFAULT_LOOKAHEAD = 25 in bdk_chain 0.23.3). bdk_wallet already exposes a lookahead() parameter for this, but bdk-cli does not use or expose it.

Related library-level context: bitcoindevkit/bdk_wallet#83, where it was noted that lookahead and stop_gap "should be fixed together". This report is about the CLI surface: the flag is accepted but has no effect with RPC, and there is no way to raise the lookahead from the CLI.

Why it matters
Bitcoin Core wallets pre-derive 1000 keys by default (DEFAULT_KEYPOOL_SIZE), so funds past index 24 are plausible. A user restoring such a backup with bdk-cli over RPC sees a successful scan and a zero balance.

Possible fixes (maintainers' call)

  1. Pass --scan-stop-gap through as the wallet lookahead for block-based backends, or add a --lookahead option.
  2. Warn or error when --scan-stop-gap is passed with --client-type rpc.
  3. Document the behavior.

Reproduction: self-contained regtest script and logs: https://gist.github.com/devdavidejesus/25b34cb7d2735f04791800c12b21d59d

Linguagem predominante
Rust
Estrelas
143
Forks
98
Merge médio
5d 21h
PRs com merge (30d)
4

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de bitcoindevkit/bdk-cli

Todas as issues de bitcoindevkit/bdk-cli

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.