Skip to content

Commit af15ebb

Browse files
committed
fix(electrum): Fix fetch_prev_txout
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.
1 parent 7607b49 commit af15ebb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/electrum/src/electrum_ext.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,10 @@ fn fetch_prev_txout<C: ElectrumApi>(
523523
for tx in full_txs {
524524
for vin in &tx.input {
525525
let outpoint = vin.previous_output;
526+
let vout = outpoint.vout;
526527
let prev_tx = fetch_tx(client, tx_cache, outpoint.txid)?;
527-
for txout in prev_tx.output.clone() {
528-
let _ = graph_update.insert_txout(outpoint, txout);
529-
}
528+
let txout = prev_tx.output[vout as usize].clone();
529+
let _ = graph_update.insert_txout(outpoint, txout);
530530
}
531531
}
532532
Ok(())

0 commit comments

Comments
 (0)