create_tx accepts recipient addresses from the wrong network
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 82/100
Direção de pesquisa
Comece por CreateTxCommand e parse_recipient, os dois pontos mencionados na issue. Acompanhe como parse_recipient transforma o destinatário em um script e como execute acessa a rede da carteira; confira as definições existentes de BDKCliError para InvalidNetwork. O trabalho estará concluído quando create_tx rejeitar um endereço de outra rede com esse erro específico antes de produzir um PSBT.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
create_tx accepts a recipient address belonging to a different network than the wallet. The transaction is built successfully, but the resulting PSBT is unspendable on the target network and only fails later at broadcast time with a node-side rejection. The cause is in parse_recipient: it calls Address::from_str (which yields Address<NetworkUnchecked>) and immediately converts to ScriptBuf via .script_pubkey(), discarding the network information before the wallet's network is known. bdk-cli therefore never compares the two.
To Reproduce
- Create a regtest wallet:
bdk-cli --network regtest wallet -w regtest_user1 --descriptor "..." --change_descriptor "..." create - Attempt to send to a testnet address:
bdk-cli --network regtest wallet -w regtest_user1 create_tx --to tb1qdgxnu...:1000 - Observe: the command succeeds and returns a PSBT.
- Broadcasting that PSBT against the regtest node fails with an address/script error, because
tb1...does not belong to the regtest network.
Expected behavior
create_tx should reject the recipient at construction time with a specific error naming the mismatch, rather than producing a PSBT that can never be spent. BDKCliError::InvalidNetwork { requested, found } should be created for this purpose. The recipient should be carried through as Address<NetworkUnchecked> and validated with require_network(ctx.state.wallet.network()) inside execute, immediately before conversion to ScriptBuf.
Build environment
- BDK-CLI tag/commit:
main - OS+version: macOS 12.7.6 (Monterey)
- Rust/Cargo version:
rustc --versionoutput - Rust/Cargo target:
x86_64-apple-darwin
Additional context
The fix is confined to CreateTxCommand and parse_recipient; no changes to the wallet API are needed.
- Linguagem predominante
- Rust
- Estrelas
- 142
- Forks
- 103
- Merge médio
- 2d 9h
- PRs com merge (30d)
- 5
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de bitcoindevkit/bdk-cli
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
bitcoindevkit/bdk-cli#358 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
bitcoindevkit/bdk-cli#357 ·
Mantenedores costumam responder em até 2 dias
-
Remove "wallet" field from `WalletConfigInner`Talvez já em andamento @Jennycj assumiu há 7 dias. Abertaenhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
bitcoindevkit/bdk-cli#332 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
bitcoindevkit/bdk-cli#359 ·
Mantenedores costumam responder em até 2 dias
-
Add wallet commands that returns a list of unused addressesTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaenhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 38/100
bitcoindevkit/bdk-cli#349 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de bitcoindevkit/bdk-cli
Issues semelhantes
-
documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
charles-hood/DiagramCraft#73 ·
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
ontologyportal/sigma-rs#200 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
chipsalliance/caliptra-sw#4311 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
`image_generation`: `max_retries` is ignored for OpenAI-compatible providers (always 2 retries)Talvez já em andamento @ericz7900 assumiu hoje. Abertallm translation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
Mantenedores costumam responder em até 1 dia