Skip to content

Commit

Permalink
refactor(chain): compute txid once for KeychainTxOutIndex::index_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlinjin committed Jun 13, 2024
1 parent 639d735 commit 8dd1744
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/chain/src/keychain/txout_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ impl<K: Clone + Ord + Debug> Indexer for KeychainTxOutIndex<K> {

fn index_tx(&mut self, tx: &bitcoin::Transaction) -> Self::ChangeSet {
let mut changeset = ChangeSet::<K>::default();
let txid = tx.compute_txid();
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
}
Expand Down

0 comments on commit 8dd1744

Please sign in to comment.