Skip to content

Commit a3f745c

Browse files
author
Ludo Galabru
committed
fix: sats overflow handling
1 parent f7d0bf8 commit a3f745c

File tree

1 file changed

+31
-0
lines changed
  • components/chainhook-event-observer/src/hord

1 file changed

+31
-0
lines changed

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

+31
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
376376
return;
377377
}
378378
};
379+
let mut sats_overflow = vec![];
380+
379381
for new_tx in block.transactions.iter_mut().skip(1) {
380382
let mut ordinals_events_indexes_to_discard = VecDeque::new();
381383
// Have a new inscription been revealed, if so, are looking at a re-inscription
@@ -428,7 +430,9 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
428430
} else {
429431
// If the satoshi inscribed correspond to a sat overflow, we will store the inscription
430432
// but exclude it from the block data
433+
sats_overflow.push(inscription.clone());
431434
ordinals_events_indexes_to_discard.push_front(ordinal_event_index);
435+
continue;
432436
}
433437
latest_inscription_number += 1;
434438
inscription.inscription_number = inscription_number;
@@ -472,6 +476,33 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
472476
new_tx.metadata.ordinal_operations.remove(index);
473477
}
474478
}
479+
480+
for inscription in sats_overflow.iter_mut() {
481+
match storage {
482+
Storage::Sqlite(rw_hord_db_conn) => {
483+
latest_inscription_number += 1;
484+
inscription.inscription_number = latest_inscription_number;
485+
ctx.try_log(|logger| {
486+
slog::info!(
487+
logger,
488+
"Inscription {} (#{}) detected on Satoshi overflow {} (block {}, {} transfers)",
489+
inscription.inscription_id,
490+
inscription.inscription_number,
491+
inscription.ordinal_number,
492+
block.block_identifier.index,
493+
inscription.transfers_pre_inscription,
494+
);
495+
});
496+
store_new_inscription(
497+
&inscription,
498+
&block.block_identifier,
499+
&rw_hord_db_conn,
500+
&ctx,
501+
);
502+
}
503+
_ => {}
504+
}
505+
}
475506
}
476507

477508
/// For each input of each transaction in the block, we retrieve the UTXO spent (outpoint_pre_transfer)

0 commit comments

Comments
 (0)