diff --git a/src/index.rs b/src/index.rs index 173bbcb5e1..6451f4a3c2 100644 --- a/src/index.rs +++ b/src/index.rs @@ -156,6 +156,7 @@ pub(crate) struct Index { genesis_block_coinbase_transaction: Transaction, genesis_block_coinbase_txid: Txid, height_limit: Option, + index_transfers: bool, no_progress_bar: bool, options: Options, unrecoverably_reorged: AtomicBool, @@ -274,6 +275,7 @@ impl Index { first_inscription_height: options.first_inscription_height(), genesis_block_coinbase_transaction, height_limit: options.height_limit, + index_transfers: options.index_transfers, no_progress_bar: options.no_progress_bar, options: options.clone(), unrecoverably_reorged: AtomicBool::new(false), diff --git a/src/index/updater.rs b/src/index/updater.rs index a634d1ef96..0194548fd0 100644 --- a/src/index/updater.rs +++ b/src/index/updater.rs @@ -380,7 +380,11 @@ impl<'index> Updater<'_> { } let mut height_to_block_hash = wtx.open_table(HEIGHT_TO_BLOCK_HASH)?; - let mut height_to_inscription_id = wtx.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?; + let mut height_to_inscription_id = if index.index_transfers { + Some(wtx.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?) + } else { + None + }; let mut inscription_id_to_inscription_entry = wtx.open_table(INSCRIPTION_ID_TO_INSCRIPTION_ENTRY)?; let mut inscription_id_to_satpoint = wtx.open_table(INSCRIPTION_ID_TO_SATPOINT)?; diff --git a/src/index/updater/inscription_updater.rs b/src/index/updater/inscription_updater.rs index 5ef53fed5f..170528e0c6 100644 --- a/src/index/updater/inscription_updater.rs +++ b/src/index/updater/inscription_updater.rs @@ -22,7 +22,7 @@ enum Origin { pub(super) struct InscriptionUpdater<'a, 'db, 'tx> { flotsam: Vec, height: u64, - height_to_inscription_id: &'a mut MultimapTable<'db, 'tx, u64, &'static InscriptionIdValue>, + height_to_inscription_id: &'a mut Option>, id_to_satpoint: &'a mut Table<'db, 'tx, &'static InscriptionIdValue, &'static SatPointValue>, value_receiver: &'a mut Receiver, id_to_entry: &'a mut Table<'db, 'tx, &'static InscriptionIdValue, InscriptionEntryValue>, @@ -44,7 +44,7 @@ pub(super) struct InscriptionUpdater<'a, 'db, 'tx> { impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> { pub(super) fn new( height: u64, - height_to_inscription_id: &'a mut MultimapTable<'db, 'tx, u64, &'static InscriptionIdValue>, + height_to_inscription_id: &'a mut Option>, id_to_satpoint: &'a mut Table<'db, 'tx, &'static InscriptionIdValue, &'static SatPointValue>, value_receiver: &'a mut Receiver, id_to_entry: &'a mut Table<'db, 'tx, &'static InscriptionIdValue, InscriptionEntryValue>, @@ -377,9 +377,9 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> { old_satpoint, new_satpoint ); - self - .height_to_inscription_id - .insert(&self.height, &inscription_id)?; + if let Some(height_to_inscription_id) = &mut self.height_to_inscription_id { + height_to_inscription_id.insert(&self.height, &inscription_id)?; + } self.satpoint_to_id.remove_all(&old_satpoint.store())?; false diff --git a/src/options.rs b/src/options.rs index a940e90bb9..a653e3f89e 100644 --- a/src/options.rs +++ b/src/options.rs @@ -50,6 +50,8 @@ pub(crate) struct Options { pub(crate) index: Option, #[clap(long, help = "Track location of all satoshis.")] pub(crate) index_sats: bool, + #[clap(long, help = "Track transfers of inscriptions.")] + pub(crate) index_transfers: bool, #[clap( long, help = "Track location of all satoshis and the utxos that own them. Implies --index-sats."