mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
[validation] Cache merkle root and witness commitment checks
Slight performance improvement by avoiding duplicate work.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user