public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [bitcoindev] Transaction Validation Optimization
@ 2025-02-18 15:22 John
  2025-02-19  5:47 ` Eric Voskuil
  2025-02-19 18:20 ` Pieter Wuille
  0 siblings, 2 replies; 3+ messages in thread
From: John @ 2025-02-18 15:22 UTC (permalink / raw)
  To: Bitcoin Development Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1483 bytes --]



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)

I'm particularly seeking clarification on two aspects: First, does the 
current implementation indeed perform full re-validation of mempool 
transactions during block processing? Second, if such optimization is 
theoretically possible, what subtle risks might emerge regarding 
transaction propagation timing or node synchronization that a newcomer like 
myself might overlook?

I'd be grateful for any insights about historical design decisions in this 
area, critical code sections I should study more deeply, or potential 
pitfalls in this line of thinking. 

Thanks in advance for sharing your expertise,
John

-- 
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 bitcoindev+unsubscribe@googlegroups•com.
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/3c2b1e7a-ffcd-41da-a533-2d9224fc016fn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3938 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bitcoindev] Transaction Validation Optimization
  2025-02-18 15:22 [bitcoindev] Transaction Validation Optimization John
@ 2025-02-19  5:47 ` Eric Voskuil
  2025-02-19 18:20 ` Pieter Wuille
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Voskuil @ 2025-02-19  5:47 UTC (permalink / raw)
  To: John; +Cc: bitcoindev, bitcoindev

[-- Attachment #1: Type: text/html, Size: 6420 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bitcoindev] Transaction Validation Optimization
  2025-02-18 15:22 [bitcoindev] Transaction Validation Optimization John
  2025-02-19  5:47 ` Eric Voskuil
@ 2025-02-19 18:20 ` Pieter Wuille
  1 sibling, 0 replies; 3+ messages in thread
From: Pieter Wuille @ 2025-02-19 18:20 UTC (permalink / raw)
  To: John; +Cc: Bitcoin Development Mailing List

On Tuesday, February 18th, 2025 at 10:22 AM, John <csdarkcounter@gmail•com> 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 bitcoindev+unsubscribe@googlegroups•com.
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/PwJsLY2Y0zpBfSnWT-O1iP-r6n7sipm-EFgK-LnnZqkPMoSUO6HJxigmt2J0CRTd8A6V4UVpA-JFCd6MaXZ0Up1bye5zVxXGdSrhIsyr38s%3D%40wuille.net.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-19 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18 15:22 [bitcoindev] Transaction Validation Optimization John
2025-02-19  5:47 ` Eric Voskuil
2025-02-19 18:20 ` Pieter Wuille

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox