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.
This commit is contained in:
parent
7607b49283
commit
af15ebba94
@ -523,12 +523,12 @@ fn fetch_prev_txout<C: ElectrumApi>(
|
|||||||
for tx in full_txs {
|
for tx in full_txs {
|
||||||
for vin in &tx.input {
|
for vin in &tx.input {
|
||||||
let outpoint = vin.previous_output;
|
let outpoint = vin.previous_output;
|
||||||
|
let vout = outpoint.vout;
|
||||||
let prev_tx = fetch_tx(client, tx_cache, outpoint.txid)?;
|
let prev_tx = fetch_tx(client, tx_cache, outpoint.txid)?;
|
||||||
for txout in prev_tx.output.clone() {
|
let txout = prev_tx.output[vout as usize].clone();
|
||||||
let _ = graph_update.insert_txout(outpoint, txout);
|
let _ = graph_update.insert_txout(outpoint, txout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user