Subject: Re: [bitcoindev] Transaction Validation Optimization

From: Pieter Wuille <[email-masked]>
Date: Wed, 19 Feb 2025 18:20:51 +0000

On Tuesday, February 18th, 2025 at 10:22 AM, John <[email-masked]> wrote:

> Hi everyone,
> 
> While analyzing the codebase, I observed what seems to be duplicate validation steps for transactions that already exist in the mempool when they appear in new blocks. Specifically, I'm curious if the secondary validation performed during block acceptance could be safely optimized for SegWit-verified transactions using their wtxid hashes.（I'm still working on the source code, and I'm not sure if the source code was validated twice

Bitcoin Core maintains a signature validation cache and a script validation cache (see the ValidationCache class), which generally means that mempool transactions don't need to be (fully) validated again when seen in a block. The script validation cache includes the validation flags (including which consensus rules are active) too, so the cache will not function across softfork activations, for example.

-- 
Pieter

-- 
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email-masked].
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/PwJsLY2Y0zpBfSnWT-O1iP-r6n7sipm-EFgK-LnnZqkPMoSUO6HJxigmt2J0CRTd8A6V4UVpA-JFCd6MaXZ0Up1bye5zVxXGdSrhIsyr38s%3D%40wuille.net.