Skip to content

Commit

Permalink
Merge pull request #413 from evoskuil/master
Browse files Browse the repository at this point in the history
Use tx.set_nominal_hash() vs. set_hash().
  • Loading branch information
evoskuil authored May 31, 2024
2 parents f1e2594 + 3643a2b commit 02381ca
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 02381ca

Please sign in to comment.