Skip to content

Commit dbca70c

Browse files
author
Ludo Galabru
committed
fix: zeromq, subsidy issue
1 parent 4a2a6ef commit dbca70c

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use chainhook_event_observer::chainhooks::types::{
1313
StacksPrintEventBasedPredicate,
1414
};
1515
use chainhook_event_observer::hord::db::{
16-
delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db,
17-
find_block_at_block_height, find_last_block_inserted, find_watched_satpoint_for_inscription,
18-
initialize_hord_db, insert_entry_in_blocks, open_readonly_hord_db_conn,
19-
open_readonly_hord_db_conn_rocks_db, open_readwrite_hord_db_conn,
20-
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage, LazyBlock,
16+
delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db, find_block_at_block_height,
17+
find_last_block_inserted, find_watched_satpoint_for_inscription, initialize_hord_db,
18+
insert_entry_in_blocks, open_readonly_hord_db_conn, open_readonly_hord_db_conn_rocks_db,
19+
open_readwrite_hord_db_conn, open_readwrite_hord_db_conn_rocks_db,
20+
retrieve_satoshi_point_using_lazy_storage, LazyBlock,
2121
};
2222
use chainhook_event_observer::hord::{
2323
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,

components/chainhook-event-observer/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ features = ["lz4", "snappy"]
6464

6565
[features]
6666
default = ["cli", "ordinals"]
67-
zeromq = ["zeromq"]
67+
zeromq = ["dep:zeromq"]
6868
cli = ["clap", "clap_generate", "toml", "ctrlc", "log"]
6969
log = ["hiro-system-kit/log"]
7070
ordinals = ["rocksdb", "chrono", "anyhow"]

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -1304,15 +1304,14 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
13041304

13051305
// evaluate exit condition: did we reach the **final** coinbase transaction
13061306
if coinbase_txid.eq(&txid) {
1307-
let coinbase_value = &lazy_block.get_coinbase_sats();
1308-
if ordinal_offset.lt(coinbase_value) {
1307+
let subsidy = Height(ordinal_block_number.into()).subsidy();
1308+
if ordinal_offset.lt(&subsidy) {
13091309
// Great!
13101310
break;
13111311
}
13121312

13131313
// loop over the transaction fees to detect the right range
1314-
let cut_off = ordinal_offset - coinbase_value;
1315-
let mut accumulated_fees = 0;
1314+
let mut accumulated_fees = subsidy;
13161315

13171316
for tx in lazy_block.iter_tx() {
13181317
let mut total_in = 0;
@@ -1327,7 +1326,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
13271326

13281327
let fee = total_in - total_out;
13291328
accumulated_fees += fee;
1330-
if accumulated_fees > cut_off {
1329+
if accumulated_fees > ordinal_offset {
13311330
// We are looking at the right transaction
13321331
// Retraverse the inputs to select the index to be picked
13331332
let mut sats_in = 0;

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

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use crate::indexer::bitcoin::{
2020
download_and_parse_block_with_retry, standardize_bitcoin_block, BitcoinBlockFullBreakdown,
2121
NewBitcoinBlock,
2222
};
23+
use crate::indexer::fork_scratch_pad::ForkScratchPad;
2324
use crate::indexer::{self, Indexer, IndexerConfig};
2425
use crate::utils::{send_request, Context};
2526

0 commit comments

Comments
 (0)