mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 16:52:57 +08:00
feat: add log, fix ordinal transfers scan
This commit is contained in:
@@ -12,8 +12,6 @@ use chainhook_event_observer::chainhooks::types::{
|
||||
StacksChainhookFullSpecification, StacksChainhookNetworkSpecification, StacksPredicate,
|
||||
StacksPrintEventBasedPredicate,
|
||||
};
|
||||
use chainhook_event_observer::dashmap::DashMap;
|
||||
use chainhook_event_observer::fxhash::FxBuildHasher;
|
||||
use chainhook_event_observer::hord::db::{
|
||||
delete_blocks_in_block_range_sqlite, delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db,
|
||||
find_block_at_block_height, find_block_at_block_height_sqlite,
|
||||
|
||||
@@ -154,10 +154,10 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(
|
||||
while cursor <= end_block {
|
||||
cursor += 1;
|
||||
|
||||
// Only consider inscriptions in the interval specified
|
||||
// Evaluating every single block is required for also keeping track of transfers.
|
||||
let local_traverals = match inscriptions_cache.remove(&cursor) {
|
||||
Some(entry) => entry,
|
||||
None => continue,
|
||||
None => vec![],
|
||||
};
|
||||
for (transaction_identifier, traversal_result) in local_traverals.into_iter() {
|
||||
traversals.insert(transaction_identifier, traversal_result);
|
||||
|
||||
@@ -240,7 +240,12 @@ pub fn retrieve_inscribed_satoshi_points_from_block(
|
||||
}
|
||||
Err(e) => {
|
||||
moved_ctx.try_log(|logger| {
|
||||
slog::error!(logger, "unable to open rocksdb: {e}",);
|
||||
slog::error!(
|
||||
logger,
|
||||
"Unable to retrieve satoshi point in {} ({}): {e}",
|
||||
transaction_id.hash,
|
||||
block_identifier.index
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,6 +759,21 @@ pub async fn start_observer_commands_handler(
|
||||
let mut blocks_to_rollback = vec![];
|
||||
let mut confirmed_blocks = vec![];
|
||||
|
||||
let blocks_ids_to_rollback = data
|
||||
.headers_to_rollback
|
||||
.iter()
|
||||
.map(|b| b.block_identifier.index.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
let blocks_ids_to_apply = data
|
||||
.headers_to_apply
|
||||
.iter()
|
||||
.map(|b| b.block_identifier.index.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
ctx.try_log(|logger| {
|
||||
slog::info!(logger, "Bitcoin reorg detected, will rollback blocks {} and apply blocks {}", blocks_ids_to_rollback.join(", "), blocks_ids_to_apply.join(", "))
|
||||
});
|
||||
|
||||
#[cfg(feature = "ordinals")]
|
||||
let blocks_db = match open_readwrite_hord_db_conn_rocks_db(
|
||||
&config.get_cache_path_buf(),
|
||||
|
||||
Reference in New Issue
Block a user