create_tx accepts recipient addresses from the wrong network
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia da CreateTxCommand e parse_recipient, i due punti indicati nell’issue. Segui come parse_recipient converte il destinatario in uno script e come execute accede alla rete del wallet; controlla le definizioni esistenti di BDKCliError per InvalidNetwork. Il lavoro è completato quando create_tx rifiuta un indirizzo di un’altra rete con quello specifico errore prima di produrre un PSBT.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 142
- Fork
- 103
- Merge medio
- 2g 9h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bitcoindevkit/bdk-cli
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bitcoindevkit/bdk-cli#358 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bitcoindevkit/bdk-cli#357 ·
I maintainer di solito rispondono entro 2 giorni
-
Remove "wallet" field from `WalletConfigInner`Forse già presa @Jennycj l’ha presa 7 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bitcoindevkit/bdk-cli#332 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
bitcoindevkit/bdk-cli#359 ·
I maintainer di solito rispondono entro 2 giorni
-
Add wallet commands that returns a list of unused addressesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
bitcoindevkit/bdk-cli#349 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di bitcoindevkit/bdk-cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swc-project/swc#12576 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue gpu serve
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
biomejs/biome#12475 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno