Skip to content

Commit

Permalink
rework lock time check a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Stacks committed Sep 9, 2024
1 parent fa0e110 commit 1d5fc7b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl BlockBodyProcessor {
}

fn check_block_transactions_in_context(self: &Arc<Self>, block: &Block) -> BlockProcessResult<()> {
// TODO: this is somewhat expensive during ibd, as it incurs cache misses.
let pmt = Lazy::new(|| {
let (pmt, _) = self
.window_manager
Expand All @@ -35,6 +36,12 @@ impl BlockBodyProcessor {
});

for tx in block.transactions.iter() {

// quick check to avoid the expensive Lazy eval (in most cases).
if tx.lock_time == 0 {
continue;
};

if let Err(e) = self.transaction_validator.utxo_free_tx_validation(tx, block.header.daa_score, &pmt) {
return Err(RuleError::TxInContextFailed(tx.id(), e));
}
Expand Down

0 comments on commit 1d5fc7b

Please sign in to comment.