From 3643a2bf6071f52860eab46740fb06036b8cc039 Mon Sep 17 00:00:00 2001
From: evoskuil <eric@voskuil.org>
Date: Wed, 29 May 2024 22:33:09 -0400
Subject: [PATCH] Use tx.set_nominal_hash() vs. set_hash().

---
 src/messages/block.cpp       | 4 ++--
 src/messages/transaction.cpp | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/messages/block.cpp b/src/messages/block.cpp
index eb42f67f8..963d1721b 100644
--- a/src/messages/block.cpp
+++ b/src/messages/block.cpp
@@ -66,7 +66,7 @@ typename block::cptr block::deserialize(uint32_t version,
         // If !witness then wire txs cannot have been segregated.
         if (tx->is_segregated())
         {
-            tx->set_hash(transaction::desegregated_hash(full,
+            tx->set_nominal_hash(transaction::desegregated_hash(full,
                 tx->serialized_size(false), start));
 
             if (!coinbase)
@@ -74,7 +74,7 @@ typename block::cptr block::deserialize(uint32_t version,
         }
         else
         {
-            tx->set_hash(bitcoin_hash(full, start));
+            tx->set_nominal_hash(bitcoin_hash(full, start));
         }
 
         coinbase = false;
diff --git a/src/messages/transaction.cpp b/src/messages/transaction.cpp
index 9e63f5a94..9185fd045 100644
--- a/src/messages/transaction.cpp
+++ b/src/messages/transaction.cpp
@@ -74,13 +74,14 @@ typename transaction::cptr transaction::deserialize(uint32_t version,
     {
         const auto true_size = tx.serialized_size(true);
         const auto false_size = tx.serialized_size(false);
-        tx.set_hash(desegregated_hash(true_size, false_size, data.data()));
         tx.set_witness_hash(bitcoin_hash(true_size, data.data()));
+        tx.set_nominal_hash(desegregated_hash(true_size, false_size,
+            data.data()));
     }
     else
     {
         const auto false_size = tx.serialized_size(false);
-        tx.set_hash(bitcoin_hash(false_size, data.data()));
+        tx.set_nominal_hash(bitcoin_hash(false_size, data.data()));
     }
 
     return message;