Skip to content

Commit

Permalink
Reenable is_invalid_witness_commitment, fix inverted equality in its …
Browse files Browse the repository at this point in the history
…result.
  • Loading branch information
evoskuil committed Apr 4, 2023
1 parent bbf6bcf commit e210864
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/chain/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ bool block::is_invalid_witness_commitment() const NOEXCEPT
if (coinbase.inputs_ptr()->front()->reserved_hash(reserved))
for (const auto& output: views_reverse(*coinbase.outputs_ptr()))
if (output->committed_hash(committed))
return committed == sha256::double_hash(
return committed != sha256::double_hash(
generate_merkle_root(true), reserved);

// If no block tx has witness data the commitment is optional (bip141).
Expand Down Expand Up @@ -663,9 +663,9 @@ code block::accept(const context& ctx, size_t subsidy_interval,
if (bip50 && is_hash_limit_exceeded())
return error::temporary_hash_limit;

////// Applies when witness data is present in the block.
////if (bip141 && is_invalid_witness_commitment())
//// return error::invalid_witness_commitment;
// Applies when witness data is present in the block.
if (bip141 && is_invalid_witness_commitment())
return error::invalid_witness_commitment;

// prevouts required (not ordered)

Expand Down

0 comments on commit e210864

Please sign in to comment.