Skip to content

Commit 6015df5

Browse files
committed
Merge #9912: Optimize GetWitnessHash() for non-segwit transactions
02c57b5 Optimize GetWitnessHash() for non-segwit transactions (Suhas Daftuar) Tree-SHA512: 405d07c11930f3432ae25b11232466a30ba2339be98e0fb5149934d792e014f504fedbe62b9c8e5febbbdad459bd1573ea896e527b9aa591926bbc774b895e6a
2 parents 779f2f9 + 02c57b5 commit 6015df5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/primitives/transaction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ uint256 CTransaction::ComputeHash() const
6969

7070
uint256 CTransaction::GetWitnessHash() const
7171
{
72+
if (!HasWitness()) {
73+
return GetHash();
74+
}
7275
return SerializeHash(*this, SER_GETHASH, 0);
7376
}
7477

0 commit comments

Comments
 (0)