Skip to content

Commit ce439ae

Browse files
author
Ludo Galabru
committed
fix: filter out sat overflows from payloads
1 parent b0498bb commit ce439ae

File tree

1 file changed

+21
-15
lines changed
  • components/chainhook-event-observer/src/hord

1 file changed

+21
-15
lines changed

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

+21-15
Original file line numberDiff line numberDiff line change
@@ -355,22 +355,28 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
355355

356356
match storage {
357357
Storage::Sqlite(rw_hord_db_conn) => {
358-
if let Some(_entry) = find_inscription_with_ordinal_number(
359-
&traversal.ordinal_number,
360-
&inscription_db_conn,
361-
&ctx,
362-
) {
363-
ctx.try_log(|logger| {
364-
slog::warn!(
365-
logger,
366-
"Transaction {} in block {} is overriding an existing inscription {}",
367-
new_tx.transaction_identifier.hash,
368-
block.block_identifier.index,
369-
traversal.ordinal_number
370-
);
371-
});
358+
if traversal.ordinal_number > 0 {
359+
if let Some(_entry) = find_inscription_with_ordinal_number(
360+
&traversal.ordinal_number,
361+
&inscription_db_conn,
362+
&ctx,
363+
) {
364+
ctx.try_log(|logger| {
365+
slog::warn!(
366+
logger,
367+
"Transaction {} in block {} is overriding an existing inscription {}",
368+
new_tx.transaction_identifier.hash,
369+
block.block_identifier.index,
370+
traversal.ordinal_number
371+
);
372+
});
373+
ordinals_events_indexes_to_discard.push_front(ordinal_event_index);
374+
continue;
375+
}
376+
} else {
377+
// If the satoshi inscribed correspond to a sat overflow, we will store the inscription
378+
// but exclude it from the block data
372379
ordinals_events_indexes_to_discard.push_front(ordinal_event_index);
373-
continue;
374380
}
375381
latest_inscription_number += 1;
376382
inscription.inscription_number = inscription_number;

0 commit comments

Comments
 (0)