fix: ignore invalid inscription

This commit is contained in:
Ludo Galabru
2023-04-13 20:28:25 -04:00
parent 56ba454a7d
commit f18bc00f5a
6 changed files with 12 additions and 35 deletions

27
Cargo.lock generated
View File

@@ -547,7 +547,6 @@ dependencies = [
"hiro-system-kit",
"hyper",
"rand 0.8.5",
"redb",
"reqwest",
"rocket",
"rocket_okapi",
@@ -2994,16 +2993,6 @@ dependencies = [
"cc",
]
[[package]]
name = "pyo3-build-config"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75439f995d07ddfad42b192dfcf3bc66a7ecfd8b4a1f5f6f046aa5c2c5d7677d"
dependencies = [
"once_cell",
"target-lexicon",
]
[[package]]
name = "quote"
version = "1.0.21"
@@ -3140,16 +3129,6 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "redb"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78f210bb101d3a0ddba42f67b12a1d7186e584733ad028f119c8d217d867f03d"
dependencies = [
"libc",
"pyo3-build-config",
]
[[package]]
name = "redis"
version = "0.21.6"
@@ -4258,12 +4237,6 @@ dependencies = [
"xattr",
]
[[package]]
name = "target-lexicon"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5"
[[package]]
name = "tempfile"
version = "3.3.0"

View File

@@ -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);
}

View File

@@ -278,6 +278,7 @@ impl Service {
};
}
ObserverEvent::Terminate => {
info!(self.ctx.expect_logger(), "Terminating runloop");
break;
}
_ => {}

View File

@@ -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"
@@ -57,6 +56,7 @@ zerocopy-derive = "0.3.2"
[dependencies.rocksdb]
version = "0.20.1"
default-features = false
optional = true
features = ["lz4", "snappy"]
[replace]
@@ -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"]

View File

@@ -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;
}
};

View File

@@ -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;