Skip to content

Commit

Permalink
feat: keep 1st tx in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Jun 13, 2023
1 parent 8006000 commit 0978a5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions components/chainhook-sdk/src/hord/db/mod.rs
Expand Up @@ -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")),
},
},
Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-sdk/src/indexer/bitcoin/mod.rs
Expand Up @@ -446,7 +446,7 @@ pub fn standardize_bitcoin_block(
},
timestamp: block.time as u32,
metadata: BitcoinBlockMetadata {
network: network.clone()
network: network.clone(),
},
transactions,
})
Expand Down

0 comments on commit 0978a5d

Please sign in to comment.