aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 11:03:16 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 11:03:32 +0100
commit6015df5b855fe600cf0b7a6e1782cb70315cc1b4 (patch)
treec6743e1ab2c924612ca27a4c7579f63ee945f3e0
parent779f2f97478ccb437c4e33d218944a6e161b55d8 (diff)
parent02c57b521a9e7afd4416cd027a8b397f202b08a8 (diff)
Merge #9912: Optimize GetWitnessHash() for non-segwit transactions
02c57b5 Optimize GetWitnessHash() for non-segwit transactions (Suhas Daftuar) Tree-SHA512: 405d07c11930f3432ae25b11232466a30ba2339be98e0fb5149934d792e014f504fedbe62b9c8e5febbbdad459bd1573ea896e527b9aa591926bbc774b895e6a
-rw-r--r--src/primitives/transaction.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp
index 790bc71d14..28ef1fb464 100644
--- a/src/primitives/transaction.cpp
+++ b/src/primitives/transaction.cpp
@@ -69,6 +69,9 @@ uint256 CTransaction::ComputeHash() const
uint256 CTransaction::GetWitnessHash() const
{
+ if (!HasWitness()) {
+ return GetHash();
+ }
return SerializeHash(*this, SER_GETHASH, 0);
}