Skip to content

Commit

Permalink
Merge pull request #266 from hirosystems/feat/cursed-inscriptions
Browse files Browse the repository at this point in the history
feat: attempt to support cursed inscriptions
  • Loading branch information
lgalabru authored Jun 4, 2023
2 parents a4c486b + 2b954a2 commit 825f2c9
Show file tree
Hide file tree
Showing 10 changed files with 711 additions and 443 deletions.
406 changes: 215 additions & 191 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions components/chainhook-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ use chainhook_event_observer::chainhooks::types::{
use chainhook_event_observer::hord::db::{
delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db, find_last_block_inserted,
find_lazy_block_at_block_height, find_watched_satpoint_for_inscription, initialize_hord_db,
insert_entry_in_blocks, open_readonly_hord_db_conn, open_readonly_hord_db_conn_rocks_db,
open_readwrite_hord_db_conn, open_readwrite_hord_db_conn_rocks_db,
retrieve_satoshi_point_using_lazy_storage, LazyBlock,
open_readonly_hord_db_conn, open_readonly_hord_db_conn_rocks_db, open_readwrite_hord_db_conn,
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage,
};
use chainhook_event_observer::hord::{
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
Expand Down Expand Up @@ -643,6 +642,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
&block_identifier,
&transaction_identifier,
0,
0,
Arc::new(traversals_cache),
&ctx,
)?;
Expand Down
12 changes: 6 additions & 6 deletions components/chainhook-cli/src/scan/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(
let (mut end_block, floating_end_block) = match predicate_spec.end_block {
Some(end_block) => (end_block, false),
None => match bitcoin_rpc.get_blockchain_info() {
Ok(result) => (result.blocks, true),
Ok(result) => (result.blocks - 1, true),
Err(e) => {
return Err(format!(
"unable to retrieve Bitcoin chain tip ({})",
Expand Down Expand Up @@ -184,19 +184,19 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(
}
};

update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
let _ = update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
&mut block,
&mut storage,
&traversals,
&hord_db_conn,
&ctx,
);
)?;

let _ = update_storage_and_augment_bitcoin_block_with_inscription_transfer_data(
&mut block,
&mut storage,
&ctx,
);
)?;

let inscriptions_revealed = get_inscriptions_revealed_in_block(&block)
.iter()
Expand Down Expand Up @@ -234,7 +234,7 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(

if cursor == end_block && floating_end_block {
end_block = match bitcoin_rpc.get_blockchain_info() {
Ok(result) => result.blocks,
Ok(result) => result.blocks - 1,
Err(_e) => {
continue;
}
Expand Down Expand Up @@ -294,7 +294,7 @@ pub async fn scan_bitcoin_chainstate_via_http_using_predicate(

if cursor == end_block && floating_end_block {
end_block = match bitcoin_rpc.get_blockchain_info() {
Ok(result) => result.blocks,
Ok(result) => result.blocks - 1,
Err(_e) => {
continue;
}
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 @@ -21,7 +21,7 @@ hiro-system-kit = "0.1.0"
# clarity-repl = { version = "1", path = "../../../clarinet/components/clarity-repl" }
# hiro-system-kit = { version = "0.1.0", path = "../../../clarinet/components/hiro-system-kit" }
chainhook-types = { version = "1.0.3", path = "../chainhook-types-rs" }
rocket = { version = "=0.5.0-rc.2", features = ["json"] }
rocket = { version = "=0.5.0-rc.3", features = ["json"] }
bitcoincore-rpc = "0.16.0"
bitcoincore-rpc-json = "0.16.0"
base64 = "0.13.0"
Expand All @@ -37,7 +37,7 @@ clap_generate = { version = "3.0.3", optional = true }
toml = { version = "0.5.6", features = ["preserve_order"], optional = true }
ctrlc = { version = "3.2.2", optional = true }
schemars = { version = "0.8.10" }
rocket_okapi = "0.8.0-rc.1"
rocket_okapi = "0.8.0-rc.3"
crossbeam-channel = "0.5.6"
chrono = { version = "0.4.19", optional = true }
anyhow = { version = "1.0.56", features = ["backtrace"], optional = true }
Expand Down
Loading

0 comments on commit 825f2c9

Please sign in to comment.