Skip to content

Commit

Permalink
Avoid assigning shared ptr dereference to reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Oct 31, 2024
1 parent 6690b65 commit dc8d086
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/messages/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dc8d086

Please sign in to comment.