mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 22:43:06 +08:00
fix: zeromq, subsidy issue
This commit is contained in:
@@ -13,11 +13,11 @@ use chainhook_event_observer::chainhooks::types::{
|
||||
StacksPrintEventBasedPredicate,
|
||||
};
|
||||
use chainhook_event_observer::hord::db::{
|
||||
delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db,
|
||||
find_block_at_block_height, find_last_block_inserted, 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,
|
||||
delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db, find_block_at_block_height,
|
||||
find_last_block_inserted, 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,
|
||||
};
|
||||
use chainhook_event_observer::hord::{
|
||||
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
|
||||
|
||||
@@ -64,7 +64,7 @@ features = ["lz4", "snappy"]
|
||||
|
||||
[features]
|
||||
default = ["cli", "ordinals"]
|
||||
zeromq = ["zeromq"]
|
||||
zeromq = ["dep:zeromq"]
|
||||
cli = ["clap", "clap_generate", "toml", "ctrlc", "log"]
|
||||
log = ["hiro-system-kit/log"]
|
||||
ordinals = ["rocksdb", "chrono", "anyhow"]
|
||||
|
||||
@@ -1304,15 +1304,14 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
|
||||
|
||||
// evaluate exit condition: did we reach the **final** coinbase transaction
|
||||
if coinbase_txid.eq(&txid) {
|
||||
let coinbase_value = &lazy_block.get_coinbase_sats();
|
||||
if ordinal_offset.lt(coinbase_value) {
|
||||
let subsidy = Height(ordinal_block_number.into()).subsidy();
|
||||
if ordinal_offset.lt(&subsidy) {
|
||||
// Great!
|
||||
break;
|
||||
}
|
||||
|
||||
// loop over the transaction fees to detect the right range
|
||||
let cut_off = ordinal_offset - coinbase_value;
|
||||
let mut accumulated_fees = 0;
|
||||
let mut accumulated_fees = subsidy;
|
||||
|
||||
for tx in lazy_block.iter_tx() {
|
||||
let mut total_in = 0;
|
||||
@@ -1327,7 +1326,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
|
||||
|
||||
let fee = total_in - total_out;
|
||||
accumulated_fees += fee;
|
||||
if accumulated_fees > cut_off {
|
||||
if accumulated_fees > ordinal_offset {
|
||||
// We are looking at the right transaction
|
||||
// Retraverse the inputs to select the index to be picked
|
||||
let mut sats_in = 0;
|
||||
|
||||
@@ -20,6 +20,7 @@ use crate::indexer::bitcoin::{
|
||||
download_and_parse_block_with_retry, standardize_bitcoin_block, BitcoinBlockFullBreakdown,
|
||||
NewBitcoinBlock,
|
||||
};
|
||||
use crate::indexer::fork_scratch_pad::ForkScratchPad;
|
||||
use crate::indexer::{self, Indexer, IndexerConfig};
|
||||
use crate::utils::{send_request, Context};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user