Merge bitcoin/bitcoin#33856: kernel: Refactor process_block_header to return btck_BlockValidationState

88d9bc5aa4 kernel: Return btck_BlockValidationState from process_block_header API (yuvicc)

Pull request description:

  This PR refactors `btck_chainstate_manager_process_block_header` to return `btck_BlockValidationState` by value instead of using out-parameters or boolean returns.

ACKs for top commit:
  optout21:
    ACK 88d9bc5aa4
  stickies-v:
    ACK 88d9bc5aa4
  w0xlt:
    reACK 88d9bc5aa4
  hodlinator:
    re-ACK 88d9bc5aa4

Tree-SHA512: f86b6e85aedafd78ae250930cbe34dc666c14d800e43cf8582d49aecb97faab801eff8dcc0250082ceebc3e8d32949839e030cf9f0023b56b23c8f7b7a741e49
This commit is contained in:
merge-script
2026-05-19 19:36:09 +01:00
4 changed files with 18 additions and 17 deletions

View File

@@ -1102,10 +1102,9 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
for (const auto& data : REGTEST_BLOCK_DATA) {
Block block{hex_string_to_byte_vec(data)};
BlockHeader header = block.GetHeader();
BlockValidationState state{};
BOOST_CHECK(state.GetBlockValidationResult() == BlockValidationResult::UNSET);
BOOST_CHECK(chainman->ProcessBlockHeader(header, state));
BlockValidationState state = chainman->ProcessBlockHeader(header);
BOOST_CHECK(state.GetValidationMode() == ValidationMode::VALID);
BOOST_CHECK(state.GetBlockValidationResult() == BlockValidationResult::UNSET);
BlockTreeEntry entry{*chainman->GetBlockTreeEntry(header.Hash())};
BOOST_CHECK(!chainman->GetChain().Contains(entry));
BlockTreeEntry best_entry{chainman->GetBestEntry()};