aboutsummaryrefslogtreecommitdiff
path: root/src/primitives/transaction.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-03-03 13:33:32 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2017-03-03 13:33:42 -0500
commit02c57b521a9e7afd4416cd027a8b397f202b08a8 (patch)
treef30eaa3d62406de6126facd24e1f7cfc829b7530 /src/primitives/transaction.cpp
parentd19d45a1e6a4345a57d5983d466b16dadbec0da9 (diff)
Optimize GetWitnessHash() for non-segwit transactions
Diffstat (limited to 'src/primitives/transaction.cpp')
-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);
}