Skip to content

Commit 02c57b5

Browse files
committed
Optimize GetWitnessHash() for non-segwit transactions
1 parent d19d45a commit 02c57b5

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)