Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

create_tx accepts recipient addresses from the wrong network

オープン 初心者向け
#360 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend, cli

調査の方向性

Issueで挙げられている2か所、CreateTxCommandとparse_recipientから始めます。parse_recipientが受取人をどのようにスクリプトに変換するか、またexecuteがウォレットのネットワークにどのようにアクセスするかを追い、InvalidNetworkに関する既存のBDKCliErrorの定義を確認してください。create_txがPSBTを生成する前に、別のネットワークのアドレスをその特定のエラーで拒否すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

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

  1. Create a regtest wallet:
    bdk-cli --network regtest wallet -w regtest_user1 --descriptor "..." --change_descriptor "..." create
    
  2. Attempt to send to a testnet address:
    bdk-cli --network regtest wallet -w regtest_user1 create_tx --to tb1qdgxnu...:1000
    
  3. Observe: the command succeeds and returns a PSBT.
  4. 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 --version output
  • 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bitcoindevkit/bdk-cli のほかの issue

bitcoindevkit/bdk-cli の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。