Skip to content

Commit 306f850

Browse files
committed
fix: imitate overflow behavior
1 parent 22eb729 commit 306f850

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

components/ordhook-core/src/core/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ pub enum SatPosition {
5959
pub fn resolve_absolute_pointer(inputs: &Vec<u64>, absolute_pointer_value: u64) -> (usize, u64) {
6060
let mut selected_index = 0;
6161
let mut cumulated_input_value = 0;
62+
// Check for overflow
63+
let total: u64 = inputs.iter().sum();
64+
if absolute_pointer_value > total {
65+
return (0, 0)
66+
}
67+
// Identify the input + satoshi offset being inscribed
6268
for (index, input_value) in inputs.iter().enumerate() {
6369
if (cumulated_input_value + input_value) > absolute_pointer_value {
6470
selected_index = index;

components/ordhook-core/src/core/protocol/inscription_parsing.rs

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ pub fn parse_inscriptions_from_witness(
2121
witness_bytes: Vec<Vec<u8>>,
2222
txid: &str,
2323
) -> Option<Vec<OrdinalInscriptionRevealData>> {
24+
25+
// Efficient debugging: Isolate one specific transaction
26+
// if !txid.eq("aa2ab56587c7d6609c95157e6dff37c5c3fa6531702f41229a289a5613887077") {
27+
// return None
28+
// }
29+
2430
let witness = Witness::from_slice(&witness_bytes);
2531
let tapscript = witness.tapscript()?;
2632
let envelopes: Vec<Envelope<Inscription>> = RawEnvelope::from_tapscript(tapscript, input_index)

0 commit comments

Comments
 (0)