refactor(chain): compute txid once for KeychainTxOutIndex::index_tx
This commit is contained in:
parent
639d735ca0
commit
8dd174479f
@ -154,8 +154,9 @@ impl<K: Clone + Ord + Debug> Indexer for KeychainTxOutIndex<K> {
|
|||||||
|
|
||||||
fn index_tx(&mut self, tx: &bitcoin::Transaction) -> Self::ChangeSet {
|
fn index_tx(&mut self, tx: &bitcoin::Transaction) -> Self::ChangeSet {
|
||||||
let mut changeset = ChangeSet::<K>::default();
|
let mut changeset = ChangeSet::<K>::default();
|
||||||
|
let txid = tx.compute_txid();
|
||||||
for (op, txout) in tx.output.iter().enumerate() {
|
for (op, txout) in tx.output.iter().enumerate() {
|
||||||
changeset.append(self.index_txout(OutPoint::new(tx.compute_txid(), op as u32), txout));
|
changeset.append(self.index_txout(OutPoint::new(txid, op as u32), txout));
|
||||||
}
|
}
|
||||||
changeset
|
changeset
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user