mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-06-14 08:29:31 +08:00
fix: inscription_number
This commit is contained in:
@@ -551,9 +551,19 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
|
||||
}
|
||||
};
|
||||
|
||||
let _ = initialize_hord_db(&config.expected_cache_path(), &ctx);
|
||||
let hord_db_conn = open_readonly_hord_db_conn(&config.expected_cache_path(), &ctx)?;
|
||||
let start_block = find_latest_compacted_block_known(&hord_db_conn) as u64;
|
||||
if start_block == 0 {
|
||||
let _ = initialize_hord_db(&config.expected_cache_path(), &ctx);
|
||||
} else {
|
||||
info!(
|
||||
ctx.expect_logger(),
|
||||
"Resuming hord indexing from block #{}", start_block
|
||||
);
|
||||
}
|
||||
|
||||
perform_hord_db_update(0, end_block, cmd.network_threads, &config, &ctx).await?;
|
||||
perform_hord_db_update(start_block, end_block, cmd.network_threads, &config, &ctx)
|
||||
.await?;
|
||||
}
|
||||
DbCommand::Sync(cmd) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
|
||||
@@ -412,7 +412,8 @@ pub fn find_inscriptions_at_wached_outpoint(
|
||||
.prepare("SELECT inscription_id, inscription_number, ordinal_number, offset FROM inscriptions WHERE outpoint_to_watch = ? ORDER BY offset ASC")
|
||||
.map_err(|e| format!("unable to query inscriptions table: {}", e.to_string()))?;
|
||||
let mut results = vec![];
|
||||
let mut rows = stmt.query(args)
|
||||
let mut rows = stmt
|
||||
.query(args)
|
||||
.map_err(|e| format!("unable to query inscriptions table: {}", e.to_string()))?;
|
||||
while let Ok(Some(row)) = rows.next() {
|
||||
let inscription_id: String = row.get(0).unwrap();
|
||||
|
||||
@@ -211,7 +211,7 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
|
||||
} else {
|
||||
inscription.inscription_number =
|
||||
match find_latest_inscription_number(&hord_db_conn, &ctx) {
|
||||
Ok(inscription_number) => inscription_number,
|
||||
Ok(inscription_number) => inscription_number + 1,
|
||||
Err(e) => {
|
||||
ctx.try_log(|logger| {
|
||||
slog::error!(
|
||||
|
||||
Reference in New Issue
Block a user