Merge bitcoin/bitcoin#26272: test: Prevent UB in `minisketch_tests.cpp`

97007e2b9b test: Prevent UB in `minisketch_tests.cpp` (Hennadii Stepanov)

Pull request description:

  [`std::optional::operator*`](https://en.cppreference.com/w/cpp/utility/optional/operator*), which follows after the changed line, can cause UB.

  This PR addresses https://github.com/bitcoin/bitcoin/issues/26262#issuecomment-1268855418

ACKs for top commit:
  stickies-v:
    ACK 97007e2b9b

Tree-SHA512: a7dde8dac0cbdfa362fa1158b4564eccff9405852612227d581690c9a34084b3467ae6d4c0269262688d75339dcea90aaa38fccbba9be92d2643c2113860f3d6
pull/25666/head
MacroFake 2 years ago
commit 73b61717a9
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(minisketch_test)
Minisketch sketch_c = std::move(sketch_ar);
sketch_c.Merge(sketch_br);
auto dec = sketch_c.Decode(errors);
BOOST_CHECK(dec.has_value());
BOOST_REQUIRE(dec.has_value());
auto sols = std::move(*dec);
std::sort(sols.begin(), sols.end());
for (uint32_t i = 0; i < a_not_b; ++i) BOOST_CHECK_EQUAL(sols[i], start_a + i);

Loading…
Cancel
Save