diff options
author | dergoegge <n.goeggi@gmail.com> | 2024-02-06 10:07:18 +0000 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2024-02-27 14:19:15 +0000 |
commit | 1ec6bbeb8d27d31647d1433ccb87b362f6d81f90 (patch) | |
tree | c7e3a084274b9e13e0d68bd0e0f72d43b357c5f9 /src/primitives | |
parent | 5bf4f5ba32da4627f152b54d266df9b2aa930457 (diff) | |
download | bitcoin-1ec6bbeb8d27d31647d1433ccb87b362f6d81f90.tar.xz |
[validation] Cache merkle root and witness commitment checks
Slight performance improvement by avoiding duplicate work.
Diffstat (limited to 'src/primitives')
-rw-r--r-- | src/primitives/block.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/primitives/block.h b/src/primitives/block.h index 99accfc7dd..832f8a03f7 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -71,8 +71,10 @@ public: // network and disk std::vector<CTransactionRef> vtx; - // memory only - mutable bool fChecked; + // Memory-only flags for caching expensive checks + mutable bool fChecked; // CheckBlock() + mutable bool m_checked_witness_commitment{false}; // CheckWitnessCommitment() + mutable bool m_checked_merkle_root{false}; // CheckMerkleRoot() CBlock() { @@ -95,6 +97,8 @@ public: CBlockHeader::SetNull(); vtx.clear(); fChecked = false; + m_checked_witness_commitment = false; + m_checked_merkle_root = false; } CBlockHeader GetBlockHeader() const |