create_tx accepts recipient addresses from the wrong network
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Issueで挙げられている2か所、CreateTxCommandとparse_recipientから始めます。parse_recipientが受取人をどのようにスクリプトに変換するか、またexecuteがウォレットのネットワークにどのようにアクセスするかを追い、InvalidNetworkに関する既存のBDKCliErrorの定義を確認してください。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時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンenhancement
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
bitcoindevkit/bdk-cli#349 ·
メンテナーはふだん 2 日以内に返信
bitcoindevkit/bdk-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
swc-project/swc#12576 ·
メンテナーはふだん 1 日以内に返信
-
good first issue gpu serve
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
biomejs/biome#12475 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信