Skip to content

Commit f18bc00

Browse files
author
Ludo Galabru
committed
fix: ignore invalid inscription
1 parent 56ba454 commit f18bc00

File tree

6 files changed

+12
-35
lines changed

6 files changed

+12
-35
lines changed

Cargo.lock

-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/chainhook-cli/src/scan/bitcoin.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,12 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(
145145
let hord_db_conn = open_readonly_hord_db_conn(&config.expected_cache_path(), ctx)?;
146146

147147
let mut storage = Storage::Memory(BTreeMap::new());
148-
for (cursor, local_traverals) in inscriptions_cache.into_iter() {
148+
for cursor in start_block..=end_block {
149149
// Only consider inscriptions in the interval specified
150-
if cursor < start_block || cursor > end_block {
151-
continue;
152-
}
150+
let local_traverals = match inscriptions_cache.remove(&cursor) {
151+
Some(entry) => entry,
152+
None => continue
153+
};
153154
for (transaction_identifier, traversal_result) in local_traverals.into_iter() {
154155
traversals.insert(transaction_identifier, traversal_result);
155156
}

components/chainhook-cli/src/service/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ impl Service {
278278
};
279279
}
280280
ObserverEvent::Terminate => {
281+
info!(self.ctx.expect_logger(), "Terminating runloop");
281282
break;
282283
}
283284
_ => {}

components/chainhook-event-observer/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ ctrlc = { version = "3.2.2", optional = true }
3939
schemars = { version = "0.8.10" }
4040
rocket_okapi = "0.8.0-rc.1"
4141
crossbeam-channel = "0.5.6"
42-
redb = { version = "0.13.0", optional = true }
4342
chrono = { version = "0.4.19", optional = true }
4443
anyhow = { version = "1.0.56", features = ["backtrace"], optional = true }
4544
futures = "0.3.21"
@@ -57,6 +56,7 @@ zerocopy-derive = "0.3.2"
5756
[dependencies.rocksdb]
5857
version = "0.20.1"
5958
default-features = false
59+
optional = true
6060
features = ["lz4", "snappy"]
6161

6262
[replace]
@@ -66,4 +66,4 @@ features = ["lz4", "snappy"]
6666
default = ["cli", "ordinals"]
6767
cli = ["clap", "clap_generate", "toml", "ctrlc", "log"]
6868
log = ["hiro-system-kit/log"]
69-
ordinals = ["redb", "chrono", "anyhow"]
69+
ordinals = ["rocksdb", "chrono", "anyhow"]

components/chainhook-event-observer/src/hord/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
198198
Some(traversal) => traversal,
199199
None => {
200200
ctx.try_log(|logger| {
201-
slog::error!(logger, "unable to retrieve satoshi point",);
201+
slog::info!(logger, "Unable to retrieve cached inscription data for inscription {}", new_tx.transaction_identifier.hash);
202202
});
203+
ordinals_events_indexes_to_discard.push_front(ordinal_event_index);
203204
continue;
204205
}
205206
};

components/chainhook-event-observer/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ extern crate serde_derive;
1010
extern crate serde_json;
1111

1212
pub extern crate bitcoincore_rpc;
13-
pub extern crate redb;
13+
pub extern crate rocksdb;
14+
1415
pub use chainhook_types;
1516

1617
pub mod chainhooks;

0 commit comments

Comments
 (0)