mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-05-01 05:01:50 +08:00
fix: off by one isssue
This commit is contained in:
@@ -1370,7 +1370,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
|
|||||||
// evaluate exit condition: did we reach the **final** coinbase transaction
|
// evaluate exit condition: did we reach the **final** coinbase transaction
|
||||||
if coinbase_txid.eq(&txid) {
|
if coinbase_txid.eq(&txid) {
|
||||||
let subsidy = Height(ordinal_block_number.into()).subsidy();
|
let subsidy = Height(ordinal_block_number.into()).subsidy();
|
||||||
if ordinal_offset.lt(&subsidy) {
|
if ordinal_offset < subsidy {
|
||||||
// Great!
|
// Great!
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1400,7 +1400,7 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
|
|||||||
for input in tx.inputs.into_iter() {
|
for input in tx.inputs.into_iter() {
|
||||||
sats_in += input.txin_value;
|
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_offset = total_out - (sats_in - input.txin_value);
|
||||||
ordinal_block_number = input.block_height;
|
ordinal_block_number = input.block_height;
|
||||||
tx_cursor = (input.txin.clone(), input.vout as usize);
|
tx_cursor = (input.txin.clone(), input.vout as usize);
|
||||||
|
|||||||
Reference in New Issue
Block a user