Skip to content

Commit

Permalink
Use tx.set_nominal_hash() vs. set_hash().
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 30, 2024
1 parent f1e2594 commit 3643a2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/messages/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ 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)
tx->set_witness_hash(bitcoin_hash(full, start));
}
else
{
tx->set_hash(bitcoin_hash(full, start));
tx->set_nominal_hash(bitcoin_hash(full, start));
}

coinbase = false;
Expand Down
5 changes: 3 additions & 2 deletions src/messages/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3643a2b

Please sign in to comment.