feat: keep 1st tx in cache

This commit is contained in:
Ludo Galabru
2023-06-13 00:34:57 -04:00
parent 8006000034
commit 0978a5d4c1
2 changed files with 8 additions and 5 deletions

View File

@@ -966,10 +966,13 @@ pub fn retrieve_satoshi_point_using_lazy_storage(
return Err(format!("block #{ordinal_block_number} not in database"));
}
Some(block) => match block.find_and_serialize_transaction_with_txid(&txid) {
Some(tx) => (
tx.get_sat_ranges(),
tx.get_cumulated_sats_in_until_input_index(input_index),
),
Some(tx) => {
let sats_ranges = tx.get_sat_ranges();
let inscription_offset_cross_outputs =
tx.get_cumulated_sats_in_until_input_index(input_index);
traversals_cache.insert((ordinal_block_number, txid.clone()), tx);
(sats_ranges, inscription_offset_cross_outputs)
}
None => return Err(format!("block #{ordinal_block_number} not in database")),
},
},

View File

@@ -446,7 +446,7 @@ pub fn standardize_bitcoin_block(
},
timestamp: block.time as u32,
metadata: BitcoinBlockMetadata {
network: network.clone()
network: network.clone(),
},
transactions,
})