Skip to content

Commit dcdfd16

Browse files
author
Ludo Galabru
committed
fix: block streaming
1 parent c31611f commit dcdfd16

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

components/hord-cli/src/core/pipeline/processors/inscription_indexing.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ pub fn process_blocks(
177177
hord_config: &HordConfig,
178178
post_processor: &Option<Sender<BitcoinBlockData>>,
179179
ctx: &Context,
180-
) {
180+
) -> Vec<BitcoinBlockData> {
181181
let mut cache_l1 = HashMap::new();
182-
182+
let mut updated_blocks = vec![];
183183
for _cursor in 0..next_blocks.len() {
184184
let mut block = next_blocks.remove(0);
185185

@@ -195,9 +195,11 @@ pub fn process_blocks(
195195
);
196196

197197
if let Some(post_processor_tx) = post_processor {
198-
let _ = post_processor_tx.send(block);
198+
let _ = post_processor_tx.send(block.clone());
199199
}
200+
updated_blocks.push(block);
200201
}
202+
updated_blocks
201203
}
202204

203205
pub fn process_block(

components/hord-cli/src/service/http_api.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn handle_create_predicate(
134134

135135
if let Ok(mut predicates_db_conn) = open_readwrite_predicates_db_conn(api_config) {
136136
let key: String = format!(
137-
"hord::{}",
137+
"{}",
138138
ChainhookSpecification::bitcoin_key(&predicate_uuid)
139139
);
140140
match get_entry_from_predicates_db(&key, &mut predicates_db_conn, &ctx) {
@@ -173,7 +173,7 @@ fn handle_get_predicate(
173173
match open_readwrite_predicates_db_conn(api_config) {
174174
Ok(mut predicates_db_conn) => {
175175
let key: String = format!(
176-
"hord::{}",
176+
"{}",
177177
ChainhookSpecification::bitcoin_key(&predicate_uuid)
178178
);
179179
let entry = match get_entry_from_predicates_db(&key, &mut predicates_db_conn, &ctx) {
@@ -272,7 +272,7 @@ pub fn get_entries_from_predicates_db(
272272
predicate_db_conn: &mut Connection,
273273
ctx: &Context,
274274
) -> Result<Vec<(ChainhookSpecification, PredicateStatus)>, String> {
275-
let key: String = format!("hord::{}", ChainhookSpecification::bitcoin_key("*"));
275+
let key: String = format!("{}", ChainhookSpecification::bitcoin_key("*"));
276276
let chainhooks_to_load: Vec<String> = predicate_db_conn
277277
.scan_match(key)
278278
.map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ impl Service {
105105
let mut bitcoin_predicates_ref: Vec<&BitcoinChainhookSpecification> =
106106
vec![];
107107
for bitcoin_predicate in chainhook_config.bitcoin_chainhooks.iter_mut() {
108-
bitcoin_predicate.enabled = false;
109108
bitcoin_predicates_ref.push(bitcoin_predicate);
110109
}
111110
while let Ok(block) = rx_replayer.recv() {
@@ -292,7 +291,7 @@ impl Service {
292291
}
293292

294293
let mut hint = InscriptionHeigthHint::new();
295-
process_blocks(
294+
let updated_blocks = process_blocks(
296295
&mut blocks,
297296
&moved_traversals_cache,
298297
&mut hint,
@@ -302,7 +301,7 @@ impl Service {
302301
&ctx,
303302
);
304303

305-
let _ = block_processor_out_tx.send(blocks);
304+
let _ = block_processor_out_tx.send(updated_blocks);
306305
}
307306
}
308307
});

0 commit comments

Comments
 (0)