Skip to content

Commit

Permalink
fix: ignore invalid inscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Apr 14, 2023
1 parent 56ba454 commit f18bc00
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 35 deletions.
27 changes: 0 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions components/chainhook-cli/src/scan/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(
let hord_db_conn = open_readonly_hord_db_conn(&config.expected_cache_path(), ctx)?;

let mut storage = Storage::Memory(BTreeMap::new());
for (cursor, local_traverals) in inscriptions_cache.into_iter() {
for cursor in start_block..=end_block {
// Only consider inscriptions in the interval specified
if cursor < start_block || cursor > end_block {
continue;
}
let local_traverals = match inscriptions_cache.remove(&cursor) {
Some(entry) => entry,
None => continue
};
for (transaction_identifier, traversal_result) in local_traverals.into_iter() {
traversals.insert(transaction_identifier, traversal_result);
}
Expand Down
1 change: 1 addition & 0 deletions components/chainhook-cli/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ impl Service {
};
}
ObserverEvent::Terminate => {
info!(self.ctx.expect_logger(), "Terminating runloop");
break;
}
_ => {}
Expand Down
4 changes: 2 additions & 2 deletions components/chainhook-event-observer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ctrlc = { version = "3.2.2", optional = true }
schemars = { version = "0.8.10" }
rocket_okapi = "0.8.0-rc.1"
crossbeam-channel = "0.5.6"
redb = { version = "0.13.0", optional = true }
chrono = { version = "0.4.19", optional = true }
anyhow = { version = "1.0.56", features = ["backtrace"], optional = true }
futures = "0.3.21"
Expand All @@ -57,6 +56,7 @@ zerocopy-derive = "0.3.2"
[dependencies.rocksdb]
version = "0.20.1"
default-features = false
optional = true
features = ["lz4", "snappy"]

[replace]
Expand All @@ -66,4 +66,4 @@ features = ["lz4", "snappy"]
default = ["cli", "ordinals"]
cli = ["clap", "clap_generate", "toml", "ctrlc", "log"]
log = ["hiro-system-kit/log"]
ordinals = ["redb", "chrono", "anyhow"]
ordinals = ["rocksdb", "chrono", "anyhow"]
3 changes: 2 additions & 1 deletion components/chainhook-event-observer/src/hord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
Some(traversal) => traversal,
None => {
ctx.try_log(|logger| {
slog::error!(logger, "unable to retrieve satoshi point",);
slog::info!(logger, "Unable to retrieve cached inscription data for inscription {}", new_tx.transaction_identifier.hash);
});
ordinals_events_indexes_to_discard.push_front(ordinal_event_index);
continue;
}
};
Expand Down
3 changes: 2 additions & 1 deletion components/chainhook-event-observer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extern crate serde_derive;
extern crate serde_json;

pub extern crate bitcoincore_rpc;
pub extern crate redb;
pub extern crate rocksdb;

pub use chainhook_types;

pub mod chainhooks;
Expand Down

0 comments on commit f18bc00

Please sign in to comment.