@@ -265,9 +265,7 @@ void run_verify_test(
265265}
266266
267267template <typename T>
268- concept HasToBytes = requires (T t) {
269- { t.ToBytes () } -> std::convertible_to<std::vector<std::byte>>;
270- };
268+ concept HasToBytes = requires (T t) { t.ToBytes (); };
271269
272270template <typename T>
273271void CheckHandle (T object, T distinct_object)
@@ -277,7 +275,9 @@ void CheckHandle(T object, T distinct_object)
277275 BOOST_CHECK (object.get () != distinct_object.get ());
278276
279277 if constexpr (HasToBytes<T>) {
280- BOOST_CHECK_NE (object.ToBytes ().size (), distinct_object.ToBytes ().size ());
278+ const auto object_bytes = object.ToBytes ();
279+ const auto distinct_bytes = distinct_object.ToBytes ();
280+ BOOST_CHECK (!std::ranges::equal (object_bytes, distinct_bytes));
281281 }
282282
283283 // Copy constructor
@@ -321,7 +321,8 @@ void CheckRange(const RangeType& range, size_t expected_size)
321321 using value_type = std::ranges::range_value_t <RangeType>;
322322
323323 BOOST_CHECK_EQUAL (range.size (), expected_size);
324- BOOST_CHECK_EQUAL (range.empty (), (expected_size == 0 ));
324+ BOOST_REQUIRE (range.size () > 0 ); // Some checks below assume a non-empty range
325+ BOOST_REQUIRE (!range.empty ());
325326
326327 BOOST_CHECK (range.begin () != range.end ());
327328 BOOST_CHECK_EQUAL (std::distance (range.begin (), range.end ()), static_cast <std::ptrdiff_t >(expected_size));
@@ -332,7 +333,6 @@ void CheckRange(const RangeType& range, size_t expected_size)
332333 BOOST_CHECK_EQUAL (range[i].get (), (*(range.begin () + i)).get ());
333334 }
334335
335- BOOST_CHECK_NE (range.at (0 ).get (), range.at (expected_size - 1 ).get ());
336336 BOOST_CHECK_THROW (range.at (expected_size), std::out_of_range);
337337
338338 BOOST_CHECK_EQUAL (range.front ().get (), range[0 ].get ());
@@ -792,7 +792,9 @@ void chainman_reindex_test(TestDirectory& test_directory)
792792{
793793 auto notifications{std::make_shared<TestKernelNotifications>()};
794794 auto context{create_context (notifications, ChainType::MAINNET)};
795- auto chainman{create_chainman (test_directory, true , false , false , false , context)};
795+ auto chainman{create_chainman (
796+ test_directory, /* reindex=*/ true , /* wipe_chainstate=*/ false ,
797+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
796798
797799 std::vector<std::string> import_files;
798800 BOOST_CHECK (chainman->ImportBlocks (import_files));
@@ -835,7 +837,9 @@ void chainman_reindex_chainstate_test(TestDirectory& test_directory)
835837{
836838 auto notifications{std::make_shared<TestKernelNotifications>()};
837839 auto context{create_context (notifications, ChainType::MAINNET)};
838- auto chainman{create_chainman (test_directory, false , true , false , false , context)};
840+ auto chainman{create_chainman (
841+ test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ true ,
842+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
839843
840844 std::vector<std::string> import_files;
841845 import_files.push_back ((test_directory.m_directory / " blocks" / " blk00000.dat" ).string ());
@@ -847,7 +851,9 @@ void chainman_mainnet_validation_test(TestDirectory& test_directory)
847851 auto notifications{std::make_shared<TestKernelNotifications>()};
848852 auto validation_interface{std::make_shared<TestValidationInterface>()};
849853 auto context{create_context (notifications, ChainType::MAINNET, validation_interface)};
850- auto chainman{create_chainman (test_directory, false , false , false , false , context)};
854+ auto chainman{create_chainman (
855+ test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ false ,
856+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
851857
852858 // mainnet block 1
853859 auto raw_block = hex_string_to_byte_vec (" 010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e857233e0e61bc6649ffff001d01e362990101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac00000000" );
@@ -975,7 +981,9 @@ BOOST_AUTO_TEST_CASE(btck_chainman_in_memory_tests)
975981
976982 auto notifications{std::make_shared<TestKernelNotifications>()};
977983 auto context{create_context (notifications, ChainType::REGTEST)};
978- auto chainman{create_chainman (in_memory_test_directory, false , false , true , true , context)};
984+ auto chainman{create_chainman (
985+ in_memory_test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ false ,
986+ /* block_tree_db_in_memory=*/ true , /* chainstate_db_in_memory=*/ true , context)};
979987
980988 for (auto & raw_block : REGTEST_BLOCK_DATA) {
981989 Block block{hex_string_to_byte_vec (raw_block)};
@@ -999,7 +1007,9 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
9991007 auto context{create_context (notifications, ChainType::REGTEST)};
10001008
10011009 {
1002- auto chainman{create_chainman (test_directory, false , false , false , false , context)};
1010+ auto chainman{create_chainman (
1011+ test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ false ,
1012+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
10031013 for (const auto & data : REGTEST_BLOCK_DATA) {
10041014 Block block{hex_string_to_byte_vec (data)};
10051015 BlockHeader header = block.GetHeader ();
@@ -1021,7 +1031,9 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
10211031 const size_t mid{REGTEST_BLOCK_DATA.size () / 2 };
10221032
10231033 {
1024- auto chainman{create_chainman (test_directory, false , false , false , false , context)};
1034+ auto chainman{create_chainman (
1035+ test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ false ,
1036+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
10251037 for (size_t i{0 }; i < mid; i++) {
10261038 Block block{hex_string_to_byte_vec (REGTEST_BLOCK_DATA[i])};
10271039 bool new_block{false };
@@ -1030,7 +1042,9 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
10301042 }
10311043 }
10321044
1033- auto chainman{create_chainman (test_directory, false , false , false , false , context)};
1045+ auto chainman{create_chainman (
1046+ test_directory, /* reindex=*/ false , /* wipe_chainstate=*/ false ,
1047+ /* block_tree_db_in_memory=*/ false , /* chainstate_db_in_memory=*/ false , context)};
10341048
10351049 for (size_t i{mid}; i < REGTEST_BLOCK_DATA.size (); i++) {
10361050 Block block{hex_string_to_byte_vec (REGTEST_BLOCK_DATA[i])};
0 commit comments