Document trust requirements for floating-prevout accounting

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

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

@Anandb71 がすでに取り組んでいます。

2026年10月18日 から。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
documentation

調査の方向性

SpkTxOutIndex::scan_txout、sent_and_received、net_value のドキュメントから始め、次に TxGraph::calculate_fee と比較します。floating-prevout の値は呼び出し元が提供する信頼前提であり、それらをスキャンまたは永続化しても正しさは検証されないことを記載します。Accounting API のドキュメントにこの点が明確に記載されれば完了です。

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

説明

documentation

Describe the bug

SpkTxOutIndex::scan_txout, sent_and_received, and net_value do not document that accounting trusts supplied floating prevouts. An incorrect value with a tracked script is used directly, even when the parent transaction is unavailable. The first insertion is also included in IndexedTxGraph's changeset, so restoring that state retains the value.

TxGraph::calculate_fee explicitly says to insert only values the caller trusts; the indexer accounting methods lack the equivalent qualification. Merely having scanned a prevout does not establish its correctness.

This issue was found by AI.

To Reproduce

  1. Track a script in SpkTxOutIndex and scan a floating prevout claiming 1_000_000 sat to that script, without its parent transaction.
  2. Call sent_and_received and net_value on a transaction spending that outpoint and returning 4_000 sat to the tracked script.
  3. The reported sent amount is 1_000_000 sat and net value is -996_000 sat, based solely on the supplied claim. The method docs mention prior scanning, but not this trust requirement.

Expected behavior

The indexer API documentation should clearly describe the trust assumptions behind floating-prevout accounting, including that scanning or persisting a value does not verify it.

主要言語
Rust
スター
1.1k
フォーク
520
平均マージ
4日 1時間
マージ済み PR(30日)
21

環境構築

はじめの一歩

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

bitcoindevkit/bdk のほかの issue

bitcoindevkit/bdk の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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