Introduce types for txids & wtxids

This commit is contained in:
dergoegge
2023-07-19 15:37:29 +02:00
parent cdb14d79e8
commit ed70e65016
9 changed files with 109 additions and 33 deletions

View File

@@ -616,7 +616,7 @@ private:
const CTransactionRef& m_ptx;
/** Txid. */
const uint256& m_hash;
const Txid& m_hash;
TxValidationState m_state;
/** A temporary cache containing serialized transaction data for signature verification.
* Reused across PolicyScriptChecks and ConsensusScriptChecks. */
@@ -1862,7 +1862,7 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
// transaction).
uint256 hashCacheEntry;
CSHA256 hasher = g_scriptExecutionCacheHasher;
hasher.Write(tx.GetWitnessHash().begin(), 32).Write((unsigned char*)&flags, sizeof(flags)).Finalize(hashCacheEntry.begin());
hasher.Write(UCharCast(tx.GetWitnessHash().begin()), 32).Write((unsigned char*)&flags, sizeof(flags)).Finalize(hashCacheEntry.begin());
AssertLockHeld(cs_main); //TODO: Remove this requirement by making CuckooCache not require external locks
if (g_scriptExecutionCache.contains(hashCacheEntry, !cacheFullScriptStore)) {
return true;