Merge bitcoin/bitcoin#34050: fuzz: exercise ComputeMerkleRoot without mutated parameter

7e9de20c0c144f5ccea5efe6d90601dd72bc7461 fuzz: exercise `ComputeMerkleRoot` without mutated parameter (Lőrinc)

Pull request description:

  The `mutated` parameter in `ComputeMerkleRoot` unlocks a different path that was always exercised in the fuzz test.
  Adjusted to be fuzzer to pass `nullptr` as well to make sure that path is also tested: 24ed820d4f/src/consensus/merkle.cpp (L49-L53)

  Follow-up to https://github.com/bitcoin/bitcoin/pull/33805#discussion_r2589073735

ACKs for top commit:
  frankomosh:
    ACK [7e9de20](7e9de20c0c)
  hodlinator:
    ACK 7e9de20c0c144f5ccea5efe6d90601dd72bc7461
  sedited:
    ACK 7e9de20c0c144f5ccea5efe6d90601dd72bc7461

Tree-SHA512: bf27029ac04003447b24a95544ec863f9ceca6c28d51ea811dd6ca2b412a2a780bb9fdbcdc82719f39dd710a746eb2446263e8377d67a8be52a1694571d03498
This commit is contained in:
merge-script 2025-12-16 14:25:55 +00:00
commit 13891a8a68
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -52,7 +52,7 @@ FUZZ_TARGET(merkle)
// Test ComputeMerkleRoot
bool mutated = fuzzed_data_provider.ConsumeBool(); // output param, initial value shouldn't matter
const uint256 merkle_root = ComputeMerkleRoot(tx_hashes, &mutated);
const uint256 merkle_root = ComputeMerkleRoot(tx_hashes, fuzzed_data_provider.ConsumeBool() ? &mutated : nullptr);
// Basic sanity checks for ComputeMerkleRoot
if (tx_hashes.size() == 1) {