Document trust requirements for floating-prevout accounting

Abierto Apto para principiantes
#2,287 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@Anandb71 ya está trabajando en esto.

Desde el 18/10/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Documentación
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Comienza con la documentación de SpkTxOutIndex::scan_txout, sent_and_received y net_value, y compárala después con TxGraph::calculate_fee. Documenta que los valores de floating-prevout son supuestos de confianza proporcionados por quien realiza la llamada, y que escanearlos o persistirlos no verifica su corrección; la tarea estará terminada cuando la documentación de la API de contabilidad lo indique claramente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
1.1k
Forks
520
Merge medio
4 d 1 h
PR fusionados (30 d)
21

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bitcoindevkit/bdk

Todos los issues de bitcoindevkit/bdk

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.