Skip to content

Commit

Permalink
Don't unnecessarily insert into utxo cache when indexing addresses (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Aug 10, 2024
1 parent b44e581 commit e59bd3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ impl<'index> Updater<'index> {
home_inscription_count,
home_inscriptions: &mut home_inscriptions,
id_to_sequence_number: &mut inscription_id_to_sequence_number,
index_addresses: self.index.index_addresses,
index_transactions: self.index.index_transactions,
inscription_number_to_sequence_number: &mut inscription_number_to_sequence_number,
lost_sats,
Expand Down
17 changes: 10 additions & 7 deletions src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(super) struct InscriptionUpdater<'a, 'tx> {
pub(super) home_inscription_count: u64,
pub(super) home_inscriptions: &'a mut Table<'tx, u32, InscriptionIdValue>,
pub(super) id_to_sequence_number: &'a mut Table<'tx, InscriptionIdValue, u32>,
pub(super) index_addresses: bool,
pub(super) index_transactions: bool,
pub(super) inscription_number_to_sequence_number: &'a mut Table<'tx, i32, u32>,
pub(super) lost_sats: u64,
Expand Down Expand Up @@ -317,13 +318,15 @@ impl<'a, 'tx> InscriptionUpdater<'a, 'tx> {

output_value = end;

self.utxo_cache.insert(
OutPoint {
vout: vout.try_into().unwrap(),
txid,
},
txout.clone(),
);
if !self.index_addresses {
self.utxo_cache.insert(
OutPoint {
vout: vout.try_into().unwrap(),
txid,
},
txout.clone(),
);
}
}

for (new_satpoint, mut flotsam, op_return) in new_locations.into_iter() {
Expand Down

0 comments on commit e59bd3e

Please sign in to comment.