Skip to content

Commit

Permalink
refactor, test: Always initialize pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 3, 2024
1 parent 8c74f93 commit 08b98f0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/test/validation_chainstate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/check.h>
#include <validation.h>

#include <vector>
Expand Down Expand Up @@ -102,14 +103,14 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)

BOOST_CHECK_EQUAL(chainman.GetAll().size(), 2);

Chainstate& background_cs{*[&] {
Chainstate& background_cs{*Assert([&]() -> Chainstate* {
for (Chainstate* cs : chainman.GetAll()) {
if (cs != &chainman.ActiveChainstate()) {
return cs;
}
}
assert(false);
}()};
return nullptr;
}())};

// Append the first block to the background chain.
BlockValidationState state;
Expand Down

0 comments on commit 08b98f0

Please sign in to comment.