Skip to content

Commit

Permalink
Skip indexing inscriptions when below first inscription also for `--i…
Browse files Browse the repository at this point in the history
…ndex-sats`(#1828)

Co-authored-by: raphjaph <raphjaph@protonmail.com>
  • Loading branch information
andrewtoth and raphjaph authored Mar 7, 2023
1 parent 8b7886d commit a4ee361
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ impl Updater {

let mut outpoint_to_value = wtx.open_table(OUTPOINT_TO_VALUE)?;

if !self.index_sats {
let index_inscriptions = self.height >= index.first_inscription_height;

if index_inscriptions {
// Send all missing input outpoints to be fetched right away
let txids = block
.txdata
Expand Down Expand Up @@ -476,6 +478,7 @@ impl Updater {
&mut sat_ranges_written,
&mut outputs_in_block,
&mut inscription_updater,
index_inscriptions,
)?;

coinbase_inputs.extend(input_sat_ranges);
Expand All @@ -490,6 +493,7 @@ impl Updater {
&mut sat_ranges_written,
&mut outputs_in_block,
&mut inscription_updater,
index_inscriptions,
)?;
}

Expand Down Expand Up @@ -548,8 +552,11 @@ impl Updater {
sat_ranges_written: &mut u64,
outputs_traversed: &mut u64,
inscription_updater: &mut InscriptionUpdater,
index_inscriptions: bool,
) -> Result {
inscription_updater.index_transaction_inscriptions(tx, txid, Some(input_sat_ranges))?;
if index_inscriptions {
inscription_updater.index_transaction_inscriptions(tx, txid, Some(input_sat_ranges))?;
}

for (vout, output) in tx.output.iter().enumerate() {
let outpoint = OutPoint {
Expand Down

0 comments on commit a4ee361

Please sign in to comment.