validation: keep script cache enabled when RDTS deployment inactive#323
validation: keep script cache enabled when RDTS deployment inactive#323kwsantiago wants to merge 1 commit into
Conversation
|
ctACK ff900da The complexity of this change exceeds my knowledge, so I can not do a human code review. I tested using the following commands on Ubuntu 24.04 running on ARMv8-A (64-bit): git clone https://github.com/bitcoinknots/bitcoin.git pr323 cmake -B build cd build |
|
@chrisguida mind taking a look? Four-line fix, keeps the script cache enabled while the RDTS deployment is inactive. |
In
Chainstate::ConnectBlock, when theREDUCED_DATAdeployment is inactive at the block being connected,GetBlockScriptFlagsdoes not setREDUCED_DATA_MANDATORY_VERIFY_FLAGSandreduced_data_start_heightis set tostd::numeric_limits<int>::max().The per-input loop then evaluates:
So
flags_per_inputgets populated for every input even though each element equalsflags. The script-verification results are identical (there is no consensus difference), butCheckInputScriptsonly writes to the script-execution cache whenflags_per_inputis empty:The net effect is that the script-execution cache is silently bypassed for every block connected while
REDUCED_DATAis inactive, i.e. the entire pre-activation history on every node syncing from genesis. This is a pure performance regression with no effect on validation results.This gates the per-input branch on
reduced_data_activesoflags_per_inputstays empty when the deployment is inactive, restoring the cache. TheDeploymentActiveAtresult is also computed once instead of twice.Behavior when
REDUCED_DATAis active is unchanged: inputs spending pre-activation coins still receive per-input flags (and correctly forgo caching for those transactions).Fix suggested by @chrisguida in review of #238.
Verification: builds cleanly;
feature_rdts.pypasses.