From dc8d086baf847c0329f67459cf703ba8d1112f79 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 31 Oct 2024 00:10:00 -0400 Subject: [PATCH] Avoid assigning shared ptr dereference to reference. --- src/messages/transaction.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/messages/transaction.cpp b/src/messages/transaction.cpp index 5005b8ad3..806bb9227 100644 --- a/src/messages/transaction.cpp +++ b/src/messages/transaction.cpp @@ -45,22 +45,22 @@ typename transaction::cptr transaction::deserialize(uint32_t version, if (!reader) return nullptr; - const auto& tx = *message->transaction_ptr; + const auto& tx = message->transaction_ptr; // Cache transaction hashes. // If !witness then wire txs cannot have been segregated. - if (tx.is_segregated()) + if (tx->is_segregated()) { - const auto true_size = tx.serialized_size(true); - const auto false_size = tx.serialized_size(false); - tx.set_witness_hash(bitcoin_hash(true_size, data.data())); - tx.set_nominal_hash(chain::transaction::desegregated_hash( + const auto true_size = tx->serialized_size(true); + const auto false_size = tx->serialized_size(false); + tx->set_witness_hash(bitcoin_hash(true_size, data.data())); + tx->set_nominal_hash(chain::transaction::desegregated_hash( true_size, false_size, data.data())); } else { - const auto false_size = tx.serialized_size(false); - tx.set_nominal_hash(bitcoin_hash(false_size, data.data())); + const auto false_size = tx->serialized_size(false); + tx->set_nominal_hash(bitcoin_hash(false_size, data.data())); } return message;