fix: handle hint and case of re-inscriptions

This commit is contained in:
Ludo Galabru
2023-07-31 17:26:40 +02:00
parent 9de3a0f081
commit f86b184832
2 changed files with 27 additions and 16 deletions

View File

@@ -1629,9 +1629,11 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
let mut latest_cursed_inscription_loaded = false;
let mut latest_cursed_inscription_number = 0;
let mut cursed_inscription_sequence_updated = false;
let mut latest_blessed_inscription_loaded = false;
let mut latest_blessed_inscription_number = 0;
let mut blessed_inscription_sequence_updated = false;
let mut sats_overflow = vec![];
@@ -1772,7 +1774,11 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
);
});
insert_entry_in_inscriptions(&inscription, &block.block_identifier, &transaction, &ctx);
if inscription.curse_type.is_some() {
cursed_inscription_sequence_updated = true;
} else {
blessed_inscription_sequence_updated = true;
}
storage_updated = true;
}
@@ -1797,12 +1803,17 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx(
insert_entry_in_inscriptions(&inscription, &block.block_identifier, &transaction, &ctx);
latest_blessed_inscription_number += 1;
storage_updated = true;
if inscription.curse_type.is_some() {
cursed_inscription_sequence_updated = true;
} else {
blessed_inscription_sequence_updated = true;
}
}
if latest_cursed_inscription_loaded {
if cursed_inscription_sequence_updated {
inscription_height_hint.cursed = Some(block.block_identifier.index);
}
if latest_blessed_inscription_loaded {
if blessed_inscription_sequence_updated {
inscription_height_hint.blessed = Some(block.block_identifier.index);
}

View File

@@ -66,20 +66,20 @@ impl Service {
// std::thread::sleep(std::time::Duration::from_secs(3600000));
// Force rebuild
// {
// let blocks_db =
// open_readwrite_hord_db_conn_rocks_db(&self.config.expected_cache_path(), &self.ctx)?;
// let inscriptions_db_conn_rw =
// open_readwrite_hord_db_conn(&self.config.expected_cache_path(), &self.ctx)?;
{
let blocks_db =
open_readwrite_hord_db_conn_rocks_db(&self.config.expected_cache_path(), &self.ctx)?;
let inscriptions_db_conn_rw =
open_readwrite_hord_db_conn(&self.config.expected_cache_path(), &self.ctx)?;
// delete_data_in_hord_db(
// 767430,
// 800000,
// &blocks_db,
// &inscriptions_db_conn_rw,
// &self.ctx,
// )?;
// }
delete_data_in_hord_db(
767430,
800000,
&blocks_db,
&inscriptions_db_conn_rw,
&self.ctx,
)?;
}
// rebuild_rocks_db(&self.config, 767400, 767429, 767400, None, &self.ctx).await?;