Previously we inserted every TxOut of a previous tx
at the same outpoint, which is incorrect because an outpoint
only points to a single TxOut. Now just get the TxOut
corresponding to the txin prevout and insert it with
its outpoint.
for tx in full_txs {
for vin in &tx.input {
let outpoint = vin.previous_output;
+ let vout = outpoint.vout;
let prev_tx = fetch_tx(client, tx_cache, outpoint.txid)?;
- for txout in prev_tx.output.clone() {
- let _ = graph_update.insert_txout(outpoint, txout);
- }
+ let txout = prev_tx.output[vout as usize].clone();
+ let _ = graph_update.insert_txout(outpoint, txout);
}
}
Ok(())