Skip to content

Commit

Permalink
fix: off by one isssue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Jul 15, 2023
1 parent f471623 commit fead2ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/hord-cli/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
// evaluate exit condition: did we reach the **final** coinbase transaction
if coinbase_txid.eq(&txid) {
let subsidy = Height(ordinal_block_number.into()).subsidy();
if ordinal_offset.lt(&subsidy) {
if ordinal_offset < subsidy {
// Great!
break;
}
Expand Down Expand Up @@ -1400,7 +1400,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
for input in tx.inputs.into_iter() {
sats_in += input.txin_value;

if sats_in >= total_out {
if sats_in > total_out {
ordinal_offset = total_out - (sats_in - input.txin_value);
ordinal_block_number = input.block_height;
tx_cursor = (input.txin.clone(), input.vout as usize);
Expand Down

0 comments on commit fead2ed

Please sign in to comment.