From 02c57b521a9e7afd4416cd027a8b397f202b08a8 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Fri, 3 Mar 2017 13:33:32 -0500 Subject: [PATCH] Optimize GetWitnessHash() for non-segwit transactions --- src/primitives/transaction.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 790bc71d14b..28ef1fb4640 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); }