create_tx accepts recipient addresses from the wrong network
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 issue 中提到的两个位置 CreateTxCommand 和 parse_recipient 开始。追踪 parse_recipient 如何将收款方转换为脚本,以及 execute 如何访问钱包网络;检查现有的 BDKCliError 定义中关于 InvalidNetwork 的内容。完成标准是:create_tx 在生成 PSBT 之前,以该特定错误拒绝来自其他网络的地址。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Rust
- 星标
- 142
- 派生
- 103
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitcoindevkit/bdk-cli 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
bitcoindevkit/bdk-cli#358 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
bitcoindevkit/bdk-cli#357 ·
维护者通常 2 天内回复
-
Remove "wallet" field from `WalletConfigInner`可能已有人在做 @Jennycj 于 7 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 72/100
bitcoindevkit/bdk-cli#332 · 2 条评论 ·
维护者通常 2 天内回复
-
enhancement
难度 3/5 1-2 天 新手友好度 55/100
bitcoindevkit/bdk-cli#359 ·
维护者通常 2 天内回复
-
Add wallet commands that returns a list of unused addresses可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭enhancement
难度 3/5 1-2 天 新手友好度 38/100
bitcoindevkit/bdk-cli#349 ·
维护者通常 2 天内回复
查看 bitcoindevkit/bdk-cli 的全部 Issue
相似的 Issue
-
`image_generation`: `max_retries` is ignored for OpenAI-compatible providers (always 2 retries)可能已有人在做 @ericz7900 今天认领。 未关闭llm translation
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
Help-Wanted Needs-Triage Package-Request
难度 2/5 1-3 小时 新手友好度 67/100
microsoft/winget-pkgs#456324 ·
维护者通常 1 天内回复
-
ai_p2
难度 2/5 1-3 小时 新手友好度 84/100
ClickHouse/ClickHouse#126833 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area/runtime good first issue size/S type/refactor
难度 2/5 1-3 小时 新手友好度 78/100
lorica-labs/volant#681 ·
维护者通常 1 天内回复