diff --git a/include/bitcoin/database/impl/query/address/address_balance.ipp b/include/bitcoin/database/impl/query/address/address_balance.ipp index a594d8416..971ed18c2 100644 --- a/include/bitcoin/database/impl/query/address/address_balance.ipp +++ b/include/bitcoin/database/impl/query/address/address_balance.ipp @@ -33,15 +33,16 @@ namespace database { // unused TEMPLATE -code CLASS::get_unconfirmed_balance(const stopper& cancel, uint64_t& out, - const hash_digest& key, bool turbo) const NOEXCEPT +code CLASS::get_unconfirmed_balance(const stopper& , uint64_t& out, + const hash_digest& , bool ) const NOEXCEPT { // While duplicates are easily filtered out, conflict resolution is murky. // An output may have multiple directly or indirectly conflicting spends, // and other spends and receives may not be visible. An unconfirmed balance // is therefore inherehtly ambiguous. Given the lack of tx pooling, - // presently we just return combined = confirmed (net zero unconfirmed). - return get_confirmed_balance(cancel, out, key, turbo); + // presently we just return zero unconfirmed. + out = zero; + return error::success; } // server/native @@ -69,11 +70,11 @@ code CLASS::get_confirmed_balance(const stopper& cancel, uint64_t& out, // server/electrum TEMPLATE code CLASS::get_balance(const stopper& cancel, uint64_t& confirmed, - uint64_t& combined, const hash_digest& key, bool turbo) const NOEXCEPT + uint64_t& unconfirmed, const hash_digest& key, bool turbo) const NOEXCEPT { // See notes on get_unconfirmed_balance(). const auto ec = get_confirmed_balance(cancel, confirmed, key, turbo); - combined = confirmed; + unconfirmed = zero; return ec; } diff --git a/include/bitcoin/database/query.hpp b/include/bitcoin/database/query.hpp index 83b39e9a4..cdd73d67a 100644 --- a/include/bitcoin/database/query.hpp +++ b/include/bitcoin/database/query.hpp @@ -648,8 +648,9 @@ class query const hash_digest& key, bool turbo=false) const NOEXCEPT; code get_confirmed_balance(const stopper& cancel, uint64_t& out, const hash_digest& key, bool turbo=false) const NOEXCEPT; - code get_balance(const stopper& cancel, uint64_t& confirmed, uint64_t& combined, - const hash_digest& key, bool turbo=false) const NOEXCEPT; + code get_balance(const stopper& cancel, uint64_t& confirmed, + uint64_t& unconfirmed, const hash_digest& key, + bool turbo=false) const NOEXCEPT; /// Filters. /// ----------------------------------------------------------------------- diff --git a/test/mocks/blocks.cpp b/test/mocks/blocks.cpp index 119843b04..374289af8 100644 --- a/test/mocks/blocks.cpp +++ b/test/mocks/blocks.cpp @@ -103,6 +103,29 @@ bool setup_three_block_witness_store(query_t& query) NOEXCEPT query.push_confirmed(query.to_header(block2a.hash()), false); } +bool setup_three_block_confirmed_address_store(query_t& query) NOEXCEPT +{ + return query.initialize(genesis) && + query.set(block1a, database::context{ 0, 1, 0 }, false, false) && + query.set(block2a, database::context{ 0, 2, 0 }, false, false) && + query.set(test::tx4) && + query.set(test::tx5) && + query.set(block3a, database::context{ 0, 3, 0 }, false, false) && + query.push_confirmed(query.to_header(block1a.hash()), true) && + query.push_confirmed(query.to_header(block2a.hash()), true) && + query.push_confirmed(query.to_header(block2a.hash()), true); +} + +bool setup_three_block_unconfirmed_address_store(query_t& query) NOEXCEPT +{ + return query.initialize(genesis) && + query.set(block1a, database::context{ 0, 1, 0 }, false, false) && + query.set(block2a, database::context{ 0, 2, 0 }, false, false) && + query.set(test::tx4) && + query.set(test::tx5) && + query.set(block3a, database::context{ 0, 3, 0 }, false, false); +} + // Setting block metadata on a shared instance creates test side effects. // Chain objects such as blocks cannot be copied for side-effect-free metadata // tests, since block copy takes shared pointer references. So create new test diff --git a/test/mocks/blocks.hpp b/test/mocks/blocks.hpp index e54f1cecc..6fcd39d1f 100644 --- a/test/mocks/blocks.hpp +++ b/test/mocks/blocks.hpp @@ -20,13 +20,14 @@ #define LIBBITCOIN_DATABASE_TEST_MOCKS_BLOCKS_HPP #include "../test.hpp" +#include "../mocks/chunk_store.hpp" namespace test { - + +using store_t = test::chunk_store; +using query_t = test::query_accessor; using block_data = system::data_array<215>; using header_data = system::data_array<80>; -using store_t = database::store; -using query_t = database::query>; const auto events_handler = [](auto, auto) {}; extern const database::context context; @@ -107,6 +108,8 @@ extern const system::chain::block block_valid_spend_internal_2b; bool setup_three_block_store(query_t& query) NOEXCEPT; bool setup_three_block_witness_store(query_t& query) NOEXCEPT; +bool setup_three_block_confirmed_address_store(query_t& query) NOEXCEPT; +bool setup_three_block_unconfirmed_address_store(query_t& query) NOEXCEPT; } // namespace test diff --git a/test/primitives/arrayhead.cpp b/test/primitives/arrayhead.cpp index 27d46503d..561c08ea5 100644 --- a/test/primitives/arrayhead.cpp +++ b/test/primitives/arrayhead.cpp @@ -51,7 +51,7 @@ class nullptr_storage BOOST_AUTO_TEST_CASE(arrayhead__create__size__expected) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(arrayhead__create__size__expected) BOOST_AUTO_TEST_CASE(arrayhead__verify__uncreated__false) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; ////BOOST_REQUIRE(head.create()); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(arrayhead__verify__uncreated__false) BOOST_AUTO_TEST_CASE(arrayhead__verify__created__false) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(arrayhead__verify__created__false) BOOST_AUTO_TEST_CASE(arrayhead__get_body_count__created__zero) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(arrayhead__get_body_count__created__zero) BOOST_AUTO_TEST_CASE(arrayhead__set_body_count__get_body_count__expected) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(arrayhead__set_body_count__get_body_count__expected) BOOST_AUTO_TEST_CASE(arrayhead__clear__get_body_count__zero) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; test_header head{ store, buckets }; BOOST_REQUIRE(head.create()); diff --git a/test/primitives/hashhead.cpp b/test/primitives/hashhead.cpp index 6ec0c6c90..4c538afcd 100644 --- a/test/primitives/hashhead.cpp +++ b/test/primitives/hashhead.cpp @@ -56,7 +56,7 @@ class nullptr_storage BOOST_AUTO_TEST_CASE(hashhead__create__size__expected) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; hashhead_ head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(hashhead__create__size__expected) BOOST_AUTO_TEST_CASE(hashhead__verify__uncreated__false) { - data_chunk data; + data_chunk data{};; test::chunk_storage store{ data }; hashhead_ head{ store, buckets }; ////BOOST_REQUIRE(head.create()); @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(hashhead__verify__uncreated__false) BOOST_AUTO_TEST_CASE(hashhead__verify__created__false) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; hashhead_ head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(hashhead__verify__created__false) BOOST_AUTO_TEST_CASE(hashhead__get_body_count__created__zero) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; hashhead_ head{ store, buckets }; BOOST_REQUIRE(head.create()); @@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(hashhead__get_body_count__created__zero) BOOST_AUTO_TEST_CASE(hashhead__set_body_count__get__expected) { - data_chunk data; + data_chunk data{}; test::chunk_storage store{ data }; hashhead_ head{ store, buckets }; BOOST_REQUIRE(head.create()); diff --git a/test/primitives/manager.cpp b/test/primitives/manager.cpp index b526cdbe2..8c7fc3cd4 100644 --- a/test/primitives/manager.cpp +++ b/test/primitives/manager.cpp @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(manager__capacity__reserved__expected) BOOST_AUTO_TEST_CASE(manager__truncate__terminal_slab__false_unchanged) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key1, max_size_t> instance(file); BOOST_REQUIRE(!instance.truncate(linkage<4>::terminal)); @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(manager__truncate__half_full_slab__true_changed) BOOST_AUTO_TEST_CASE(manager__allocate__eof_slab__terminal_unchanged) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key1, max_size_t> instance(file); BOOST_REQUIRE_EQUAL(instance.allocate(storage::eof), linkage<7>::terminal); @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(manager__allocate__eof_slab__terminal_unchanged) BOOST_AUTO_TEST_CASE(manager__allocate__terminal_slab__terminal_unchanged) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key1, max_size_t> instance(file); BOOST_REQUIRE_EQUAL(instance.allocate(linkage<4>::terminal), linkage<4>::terminal); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(manager__allocate__terminal_slab__terminal_unchanged) BOOST_AUTO_TEST_CASE(manager__allocate__empty_slab__expected) { constexpr auto expected = 42u; - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key1, max_size_t> instance(file); BOOST_REQUIRE_EQUAL(instance.allocate(expected), zero); @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE(manager__count__33_record__expected) BOOST_AUTO_TEST_CASE(manager__truncate__terminal_record__false_unchanged) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key0, 5u> instance(file); BOOST_REQUIRE(!instance.truncate(linkage<2>::terminal)); @@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(manager__truncate__half_full_record__true_logical_size_chan BOOST_AUTO_TEST_CASE(manager__allocate__terminal_empty_record__terminal_unchanged) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key0, 5u> instance(file); BOOST_REQUIRE_EQUAL(instance.allocate(linkage<2>::terminal), linkage<2>::terminal); @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(manager__allocate__terminal_non_empty_record__expected) BOOST_AUTO_TEST_CASE(manager__allocate__empty_record__expected) { - data_chunk buffer; + data_chunk buffer{}; test::chunk_storage file(buffer); manager, key0, 5u> instance(file); BOOST_REQUIRE_EQUAL(instance.allocate(1), 0u); diff --git a/test/primitives/nomap.cpp b/test/primitives/nomap.cpp index 4296255ab..c9802de99 100644 --- a/test/primitives/nomap.cpp +++ b/test/primitives/nomap.cpp @@ -80,8 +80,8 @@ class big_record BOOST_AUTO_TEST_CASE(nomap__record_get__terminal__invalid) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; const nomap instance{ head_store, body_store }; @@ -93,8 +93,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_get__terminal__invalid) BOOST_AUTO_TEST_CASE(nomap__record_get__empty__invalid) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; const nomap instance{ head_store, body_store }; @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(nomap__record_get__empty__invalid) BOOST_AUTO_TEST_CASE(nomap__record_get__populated__valid) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x01, 0x02, 0x03, 0x04 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -120,8 +120,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_get__populated__valid) BOOST_AUTO_TEST_CASE(nomap__record_put__get__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -138,8 +138,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_put__get__expected) BOOST_AUTO_TEST_CASE(nomap__record_count__truncate__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -164,8 +164,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_count__truncate__expected) BOOST_AUTO_TEST_CASE(nomap__record_put_link__multiple__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -236,8 +236,8 @@ class big_slab BOOST_AUTO_TEST_CASE(nomap__slab_put__get__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -254,8 +254,8 @@ BOOST_AUTO_TEST_CASE(nomap__slab_put__get__expected) BOOST_AUTO_TEST_CASE(nomap__slab_count__truncate__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -280,8 +280,8 @@ BOOST_AUTO_TEST_CASE(nomap__slab_count__truncate__expected) BOOST_AUTO_TEST_CASE(nomap__slab_put_link__multiple__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -335,7 +335,7 @@ class record_excess BOOST_AUTO_TEST_CASE(nomap__record_get__excess__false) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -348,8 +348,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_get__excess__false) BOOST_AUTO_TEST_CASE(nomap__record_put_link__excess__false) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -381,7 +381,7 @@ class slab_excess BOOST_AUTO_TEST_CASE(nomap__slab_get__excess__true) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -395,8 +395,8 @@ BOOST_AUTO_TEST_CASE(nomap__slab_get__excess__true) BOOST_AUTO_TEST_CASE(nomap__slab_put_link__excess__false) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; nomap instance{ head_store, body_store }; @@ -429,7 +429,7 @@ class file_excess BOOST_AUTO_TEST_CASE(nomap__slab_get__file_excess__false) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -507,8 +507,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_reserve__commit__expected) BOOST_AUTO_TEST_CASE(nomap__record_verify__empty_files__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; record_table instance{ head_store, body_store }; @@ -523,7 +523,7 @@ BOOST_AUTO_TEST_CASE(nomap__record_verify__empty_files__expected) BOOST_AUTO_TEST_CASE(nomap__record_create__non_empty_head_file__failure) { data_chunk head_file{ 0x42 }; - data_chunk body_file; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; record_table instance{ head_store, body_store }; @@ -536,7 +536,7 @@ BOOST_AUTO_TEST_CASE(nomap__record_create__non_empty_head_file__failure) BOOST_AUTO_TEST_CASE(nomap__record_create__non_empty_body_file__body_zeroed) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x42 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -553,8 +553,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_create__non_empty_body_file__body_zeroed) BOOST_AUTO_TEST_CASE(nomap__record_body_count__create__zero) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; record_table instance{ head_store, body_store }; @@ -566,7 +566,7 @@ BOOST_AUTO_TEST_CASE(nomap__record_body_count__create__zero) BOOST_AUTO_TEST_CASE(nomap__record_body_count__empty_close__zero) { auto head_file = base16_chunk("1234567890"); - data_chunk body_file; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; record_table instance{ head_store, body_store }; @@ -631,8 +631,8 @@ BOOST_AUTO_TEST_CASE(nomap__record_body_count__non_empty_restore__truncates) BOOST_AUTO_TEST_CASE(nomap__slab_verify__empty_files__expected) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; slab_table instance{ head_store, body_store }; @@ -647,7 +647,7 @@ BOOST_AUTO_TEST_CASE(nomap__slab_verify__empty_files__expected) BOOST_AUTO_TEST_CASE(nomap__slab_create__non_empty_head_file__failure) { data_chunk head_file{ 0x42 }; - data_chunk body_file; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; slab_table instance{ head_store, body_store }; @@ -660,7 +660,7 @@ BOOST_AUTO_TEST_CASE(nomap__slab_create__non_empty_head_file__failure) BOOST_AUTO_TEST_CASE(nomap__slab_create__non_empty_body_file__body_zeroed) { - data_chunk head_file; + data_chunk head_file{}; data_chunk body_file{ 0x42 }; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; @@ -677,8 +677,8 @@ BOOST_AUTO_TEST_CASE(nomap__slab_create__non_empty_body_file__body_zeroed) BOOST_AUTO_TEST_CASE(nomap__slab_body_count__create__zero) { - data_chunk head_file; - data_chunk body_file; + data_chunk head_file{}; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; slab_table instance{ head_store, body_store }; @@ -690,7 +690,7 @@ BOOST_AUTO_TEST_CASE(nomap__slab_body_count__create__zero) BOOST_AUTO_TEST_CASE(nomap__slab_body_count__empty_close__zero) { auto head_file = base16_chunk("1234567890"); - data_chunk body_file; + data_chunk body_file{}; test::chunk_storage head_store{ head_file }; test::chunk_storage body_store{ body_file }; slab_table instance{ head_store, body_store }; diff --git a/test/query/address/address_balance.cpp b/test/query/address/address_balance.cpp index 6c91812b7..fcdf744be 100644 --- a/test/query/address/address_balance.cpp +++ b/test/query/address/address_balance.cpp @@ -32,22 +32,22 @@ BOOST_AUTO_TEST_CASE(query_address__get_balance__turbo_genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - uint64_t combined{}; + uint64_t unconfirmed{}; const std::atomic_bool cancel{}; - BOOST_REQUIRE(!query.get_unconfirmed_balance(cancel, combined, test::genesis_address, true)); - BOOST_REQUIRE_EQUAL(combined, 5000000000u); + BOOST_REQUIRE(!query.get_unconfirmed_balance(cancel, unconfirmed, test::genesis_address, true)); + BOOST_REQUIRE_EQUAL(unconfirmed, 0u); uint64_t confirmed{}; BOOST_REQUIRE(!query.get_confirmed_balance(cancel, confirmed, test::genesis_address, true)); BOOST_REQUIRE_EQUAL(confirmed, 5000000000u); - confirmed = combined = 42; - BOOST_REQUIRE(!query.get_balance(cancel, confirmed, combined, test::genesis_address, true)); + confirmed = unconfirmed = 42; + BOOST_REQUIRE(!query.get_balance(cancel, confirmed, unconfirmed, test::genesis_address, true)); BOOST_REQUIRE_EQUAL(confirmed, 5000000000u); - BOOST_REQUIRE_EQUAL(combined, 5000000000u); + BOOST_REQUIRE_EQUAL(unconfirmed, 0u); } BOOST_AUTO_TEST_CASE(query_address__get_balance__genesis__expected) @@ -56,22 +56,22 @@ BOOST_AUTO_TEST_CASE(query_address__get_balance__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - uint64_t combined{}; + uint64_t unconfirmed{}; const std::atomic_bool cancel{}; - BOOST_REQUIRE(!query.get_unconfirmed_balance(cancel, combined, test::genesis_address)); - BOOST_REQUIRE_EQUAL(combined, 5000000000u); + BOOST_REQUIRE(!query.get_unconfirmed_balance(cancel, unconfirmed, test::genesis_address)); + BOOST_REQUIRE_EQUAL(unconfirmed, 0u); uint64_t confirmed{}; BOOST_REQUIRE(!query.get_confirmed_balance(cancel, confirmed, test::genesis_address)); BOOST_REQUIRE_EQUAL(confirmed, 5000000000u); - confirmed = combined = 42; - BOOST_REQUIRE(!query.get_balance(cancel, confirmed, combined, test::genesis_address)); + confirmed = unconfirmed = 42; + BOOST_REQUIRE(!query.get_balance(cancel, confirmed, unconfirmed, test::genesis_address)); BOOST_REQUIRE_EQUAL(confirmed, 5000000000u); - BOOST_REQUIRE_EQUAL(combined, 5000000000u); + BOOST_REQUIRE_EQUAL(unconfirmed, 0u); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/query/address/address_history.cpp b/test/query/address/address_history.cpp index a72b164f4..55d810440 100644 --- a/test/query/address/address_history.cpp +++ b/test/query/address/address_history.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_history__turbo_genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); histories out{}; @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_history__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); histories out{}; diff --git a/test/query/address/address_outpoints.cpp b/test/query/address/address_outpoints.cpp index 499d50edd..0ce98582b 100644 --- a/test/query/address/address_outpoints.cpp +++ b/test/query/address/address_outpoints.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_confirmed_unspent_outputs__turbo_genesis settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_confirmed_unspent_outputs__genesis__expe settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_minimum_unspent_outputs__turbo_above__ex settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_minimum_unspent_outputs__above__excluded settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_minimum_unspent_outputs__at__included) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_minimum_unspent_outputs__below__included settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_address_outputs__turbo_genesis__expected settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_address_outputs__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_address_outputs__cancel__canceled_false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); outpoints out{}; diff --git a/test/query/address/address_unspent.cpp b/test/query/address/address_unspent.cpp index 84dead70a..dfb8c3e68 100644 --- a/test/query/address/address_unspent.cpp +++ b/test/query/address/address_unspent.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_unspent__turbo_genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); unspents out{}; @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(query_address__get_unspent__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); unspents out{}; diff --git a/test/query/archive/chain_reader.cpp b/test/query/archive/chain_reader.cpp index 10b69b706..bfa46b32d 100644 --- a/test/query/archive/chain_reader.cpp +++ b/test/query/archive/chain_reader.cpp @@ -25,103 +25,7 @@ static_assert(is_same_type < database::context::flag_t::integer, decltype(system BOOST_FIXTURE_TEST_SUITE(query_chain_reader_tests, test::directory_setup_fixture) -// is_coinbase - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_coinbase__coinbase__true) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK(!store.create(test::events_handler)); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(query.set(test::block1, context{}, false, false)); - BOOST_CHECK(query.set(test::block2, context{}, false, false)); - BOOST_CHECK(query.set(test::block3, context{}, false, false)); - BOOST_CHECK(query.is_coinbase(0)); - BOOST_CHECK(query.is_coinbase(1)); - BOOST_CHECK(query.is_coinbase(2)); - BOOST_CHECK(query.is_coinbase(3)); -} - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_coinbase__non_coinbase__false) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK(!store.create(test::events_handler)); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(query.set(test::block1a, context{}, false, false)); - BOOST_CHECK(query.set(test::block2a, context{}, false, false)); - BOOST_CHECK(!query.is_coinbase(1)); - BOOST_CHECK(!query.is_coinbase(2)); - BOOST_CHECK(!query.is_coinbase(3)); - BOOST_CHECK(!query.is_coinbase(4)); - BOOST_CHECK(!query.is_coinbase(5)); - BOOST_CHECK(!query.is_coinbase(42)); -} - -// is_tx_segregated - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_tx_segregated__always__expected) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(query.set(test::block1a, context{}, false, false)); - BOOST_CHECK(!query.is_tx_segregated(0)); - BOOST_CHECK( query.is_tx_segregated(1)); - BOOST_CHECK(!query.is_tx_segregated(2)); -} - -// is_block_segregated - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_block_segregated__always__expected) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(query.set(test::block1a, context{}, false, false)); - BOOST_CHECK(!query.is_block_segregated(0)); - BOOST_CHECK( query.is_block_segregated(1)); - BOOST_CHECK(!query.is_block_segregated(2)); -} - -// is_milestone - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_milestone__genesis__false) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(!query.is_milestone(0)); - BOOST_CHECK(!query.is_milestone(1)); -} - -BOOST_AUTO_TEST_CASE(query_chain_reader__is_milestone__set__expected) -{ - settings settings{}; - settings.path = TEST_DIRECTORY; - test::chunk_store store{ settings }; - test::query_accessor query{ store }; - BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); - BOOST_CHECK(query.initialize(test::genesis)); - BOOST_CHECK(query.set(test::block1, context{}, true, false)); - BOOST_CHECK(query.set(test::block2, context{}, false, false));; - BOOST_CHECK(!query.is_milestone(0)); - BOOST_CHECK(query.is_milestone(1)); - BOOST_CHECK(!query.is_milestone(2)); -} +// get_header BOOST_AUTO_TEST_CASE(query_chain_reader__get_header__invalid_parent__expected) { @@ -245,6 +149,104 @@ BOOST_AUTO_TEST_CASE(query_chain_reader__get_header__default__expected) BOOST_CHECK_EQUAL(pointer1->hash(), block_hash); } +// is_coinbase + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_coinbase__coinbase__true) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK(!store.create(test::events_handler)); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(query.set(test::block1, context{}, false, false)); + BOOST_CHECK(query.set(test::block2, context{}, false, false)); + BOOST_CHECK(query.set(test::block3, context{}, false, false)); + BOOST_CHECK(query.is_coinbase(0)); + BOOST_CHECK(query.is_coinbase(1)); + BOOST_CHECK(query.is_coinbase(2)); + BOOST_CHECK(query.is_coinbase(3)); +} + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_coinbase__non_coinbase__false) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK(!store.create(test::events_handler)); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(query.set(test::block1a, context{}, false, false)); + BOOST_CHECK(query.set(test::block2a, context{}, false, false)); + BOOST_CHECK(!query.is_coinbase(1)); + BOOST_CHECK(!query.is_coinbase(2)); + BOOST_CHECK(!query.is_coinbase(3)); + BOOST_CHECK(!query.is_coinbase(4)); + BOOST_CHECK(!query.is_coinbase(5)); + BOOST_CHECK(!query.is_coinbase(42)); +} + +// is_tx_segregated + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_tx_segregated__always__expected) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(query.set(test::block1a, context{}, false, false)); + BOOST_CHECK(!query.is_tx_segregated(0)); + BOOST_CHECK( query.is_tx_segregated(1)); + BOOST_CHECK(!query.is_tx_segregated(2)); +} + +// is_block_segregated + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_block_segregated__always__expected) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(query.set(test::block1a, context{}, false, false)); + BOOST_CHECK(!query.is_block_segregated(0)); + BOOST_CHECK( query.is_block_segregated(1)); + BOOST_CHECK(!query.is_block_segregated(2)); +} + +// is_milestone + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_milestone__genesis__false) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(!query.is_milestone(0)); + BOOST_CHECK(!query.is_milestone(1)); +} + +BOOST_AUTO_TEST_CASE(query_chain_reader__is_milestone__set__expected) +{ + settings settings{}; + settings.path = TEST_DIRECTORY; + test::chunk_store store{ settings }; + test::query_accessor query{ store }; + BOOST_CHECK_EQUAL(store.create(test::events_handler), error::success); + BOOST_CHECK(query.initialize(test::genesis)); + BOOST_CHECK(query.set(test::block1, context{}, true, false)); + BOOST_CHECK(query.set(test::block2, context{}, false, false));; + BOOST_CHECK(!query.is_milestone(0)); + BOOST_CHECK(query.is_milestone(1)); + BOOST_CHECK(!query.is_milestone(2)); +} + BOOST_AUTO_TEST_CASE(query_chain_reader__get_tx_keys__not_found__empty) { settings settings{}; @@ -281,17 +283,12 @@ BOOST_AUTO_TEST_CASE(query_chain_reader__get_point_key__always__expected) // tx4/5 prevouts are all block1a.tx1. BOOST_CHECK(query.set(test::tx4)); BOOST_CHECK(query.set(test::tx5)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(0), test::block1a.transactions_ptr()->front()->hash(false)); BOOST_CHECK_EQUAL(query.get_point_hash(1), test::block1a.transactions_ptr()->front()->hash(false)); BOOST_CHECK_EQUAL(query.get_point_hash(2), test::block1a.transactions_ptr()->front()->hash(false)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(3), system::null_hash); // block1a adds three prevouts of two txs. BOOST_CHECK(query.set(test::block1a, context{}, false, false)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(3), system::one_hash); BOOST_CHECK_EQUAL(query.get_point_hash(4), system::one_hash); - ////BOOST_CHECK_EQUAL(query.get_point_hash(5), test::two_hash); - ////BOOST_CHECK_EQUAL(query.get_point_hash(6), system::null_hash); } BOOST_AUTO_TEST_CASE(query_chain_reader__get_tx_key__always__expected) @@ -707,85 +704,15 @@ BOOST_AUTO_TEST_CASE(query_chain_reader__get_spenders__unspent_or_not_found__exp // Caller should always test for nullptr. BOOST_CHECK(query.get_spenders(output_link::terminal, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(tx_link::terminal, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(tx_link::terminal, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(0, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(0, 1), true)->empty()); - ///BOOST_CHECK(query.get_spenders_index(0, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(0, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(1, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(1, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(1, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(1, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(2, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(2, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(2, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(2, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(3, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(3, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(3, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(3, 1, true)->empty()); -} - -////BOOST_AUTO_TEST_CASE(query_chain_reader__get_spenders__found_and_spent__expected) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_CHECK(!store.create(test::events_handler)); -//// BOOST_CHECK(query.initialize(test::genesis)); -//// -//// // Neither of the two block1a outputs spent yet. -//// BOOST_CHECK(query.set(test::block1a, test::context, false, false)); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 0), true)->empty()); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 1), true)->empty()); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 0, true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 1, true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 2, true)->empty()); -//// -//// // Each of the two outputs of block1a spent once. -//// BOOST_CHECK(query.set(test::block2a, test::context, false, false)); -//// -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 0), true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 1), true)->size(), 1u); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 0, true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 1, true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 2, true)->size(), 0u); -//// -//// // Match the two spenders. -//// const auto block_inputs = test::block2a.transactions_ptr()->front()->inputs_ptr(); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->front() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->front() == *(*block_inputs).back()); -//// BOOST_CHECK(*query.get_spenders(1, 0)->front() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(1, 1)->front() == *(*block_inputs).back()); -//// -//// // Each of the two outputs of block1a spent twice (two unconfirmed double spends). -//// BOOST_CHECK(query.set(test::tx4)); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 0), true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 1), true)->size(), 2u); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 0, true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 1, true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 2, true)->size(), 0u); -//// -//// // Match the four spenders. -//// const auto tx_inputs = test::tx4.inputs_ptr(); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->front() == *(*tx_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->front() == *(*tx_inputs).back()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->back() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->back() == *(*block_inputs).back()); -//// BOOST_CHECK(*query.get_spenders_index(1, 0, true)->front() == *(*tx_inputs).front()); -//// BOOST_CHECK(*query.get_spenders_index(1, 1, true)->front() == *(*tx_inputs).back()); -//// BOOST_CHECK(*query.get_spenders_index(1, 0, true)->back() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders_index(1, 1, true)->back() == *(*block_inputs).back()); -////} +} BOOST_AUTO_TEST_CASE(query_chain_reader__get_value__genesis__expected) { diff --git a/test/query/archive/chain_writer.cpp b/test/query/archive/chain_writer.cpp index 11273b5b4..b8a97ec39 100644 --- a/test/query/archive/chain_writer.cpp +++ b/test/query/archive/chain_writer.cpp @@ -1134,17 +1134,12 @@ BOOST_AUTO_TEST_CASE(query_chain_writer__get_point_key__always__expected) // tx4/5 prevouts are all block1a.tx1. BOOST_CHECK(query.set(test::tx4)); BOOST_CHECK(query.set(test::tx5)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(0), test::block1a.transactions_ptr()->front()->hash(false)); BOOST_CHECK_EQUAL(query.get_point_hash(1), test::block1a.transactions_ptr()->front()->hash(false)); BOOST_CHECK_EQUAL(query.get_point_hash(2), test::block1a.transactions_ptr()->front()->hash(false)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(3), system::null_hash); // block1a adds three prevouts of two txs. BOOST_CHECK(query.set(test::block1a, context{}, false, false)); - ////BOOST_CHECK_EQUAL(query.get_point_hash(3), system::one_hash); BOOST_CHECK_EQUAL(query.get_point_hash(4), system::one_hash); - ////BOOST_CHECK_EQUAL(query.get_point_hash(5), test::two_hash); - ////BOOST_CHECK_EQUAL(query.get_point_hash(6), system::null_hash); } BOOST_AUTO_TEST_CASE(query_chain_writer__get_tx_key__always__expected) @@ -1494,86 +1489,16 @@ BOOST_AUTO_TEST_CASE(query_chain_writer__get_spenders__unspent_or_not_found__exp // Caller should always test for nullptr. BOOST_CHECK(query.get_spenders(output_link::terminal, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(tx_link::terminal, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(tx_link::terminal, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(0, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(0, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(0, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(0, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(1, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(1, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(1, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(1, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(2, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(2, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(2, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(2, 1, true)->empty()); - BOOST_CHECK(query.get_spenders(query.to_output(3, 0), true)->empty()); BOOST_CHECK(query.get_spenders(query.to_output(3, 1), true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(3, 0, true)->empty()); - ////BOOST_CHECK(query.get_spenders_index(3, 1, true)->empty()); } -////BOOST_AUTO_TEST_CASE(query_chain_writer__get_spenders__found_and_spent__expected) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_CHECK(!store.create(test::events_handler)); -//// BOOST_CHECK(query.initialize(test::genesis)); -//// -//// // Neither of the two block1a outputs spent yet. -//// BOOST_CHECK(query.set(test::block1a, test::context, false, false)); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 0), true)->empty()); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 1), true)->empty()); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 0, true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 1, true)->empty()); -//// BOOST_CHECK(query.get_spenders_index(1, 2, true)->empty()); -//// -//// // Each of the two outputs of block1a spent once. -//// BOOST_CHECK(query.set(test::block2a, test::context, false, false)); -//// -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 0), true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 1), true)->size(), 1u); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 0, true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 1, true)->size(), 1u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 2, true)->size(), 0u); -//// -//// // Match the two spenders. -//// const auto block_inputs = test::block2a.transactions_ptr()->front()->inputs_ptr(); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->front() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->front() == *(*block_inputs).back()); -//// BOOST_CHECK(*query.get_spenders(1, 0)->front() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(1, 1)->front() == *(*block_inputs).back()); -//// -//// // Each of the two outputs of block1a spent twice (two unconfirmed double spends). -//// BOOST_CHECK(query.set(test::tx4)); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 0), true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders(query.to_output(1, 1), true)->size(), 2u); -//// BOOST_CHECK(query.get_spenders(query.to_output(1, 2), true)->empty()); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 0, true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 1, true)->size(), 2u); -//// BOOST_CHECK_EQUAL(query.get_spenders_index(1, 2, true)->size(), 0u); -//// -//// // Match the four spenders. -//// const auto tx_inputs = test::tx4.inputs_ptr(); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->front() == *(*tx_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->front() == *(*tx_inputs).back()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 0), true)->back() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders(query.to_output(1, 1), true)->back() == *(*block_inputs).back()); -//// BOOST_CHECK(*query.get_spenders_index(1, 0, true)->front() == *(*tx_inputs).front()); -//// BOOST_CHECK(*query.get_spenders_index(1, 1, true)->front() == *(*tx_inputs).back()); -//// BOOST_CHECK(*query.get_spenders_index(1, 0, true)->back() == *(*block_inputs).front()); -//// BOOST_CHECK(*query.get_spenders_index(1, 1, true)->back() == *(*block_inputs).back()); -////} - BOOST_AUTO_TEST_CASE(query_chain_writer__get_value__genesis__expected) { settings settings{}; diff --git a/test/query/confirmed.cpp b/test/query/confirmed.cpp index 27367710c..7039a38f7 100644 --- a/test/query/confirmed.cpp +++ b/test/query/confirmed.cpp @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_candidate_block__push_pop_candidate__ex settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_block__push_pop_confirmed__ex settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_tx__confirm__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_input__genesis__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.is_confirmed_input(query.to_point(0, 0))); } @@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_input__unconfirmed__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); @@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_input__confirmed_weak__expect settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2a, context{ 0, 2, 0 }, false, false)); @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_input__confirmed_strong__expe settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_output__confirm__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_spent_output__genesis__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(!query.is_confirmed_spent_output(query.to_output(0, 0))); BOOST_REQUIRE(!query.is_confirmed_spent_output(query.to_output(1, 1))); @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_spent_output__strong_confirmed__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2a, context{ 0, 2, 0 }, false, false)); @@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_strong__strong__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.is_strong_tx(0)); BOOST_REQUIRE(query.is_strong_block(0)); @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_strong__weak__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); BOOST_REQUIRE(!query.is_strong_tx(1)); @@ -307,7 +307,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__set_strong__unassociated__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1.header(), context{}, false)); BOOST_REQUIRE(!query.set_strong(1)); @@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__set_strong__set_unstrong__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); @@ -370,88 +370,6 @@ BOOST_AUTO_TEST_CASE(query_confirmed__set_strong__set_unstrong__expected) BOOST_REQUIRE(!query.is_confirmed_output(query.to_output(2, 0))); } -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__spend_genesis__false) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.set(test::tx_spend_genesis)); -//// BOOST_REQUIRE(!query.is_mature(query.to_point(1, 0), 0)); -//// BOOST_REQUIRE(!query.is_mature(query.to_point(1, 0), 100)); -////} -//// -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__not_found__false) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(!query.is_mature(query.to_point(0, 1), 0)); -//// BOOST_REQUIRE(!query.is_mature(query.to_point(42, 24), 1000)); -////} -//// -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__null_input__true) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.is_mature(query.to_point(0, 0), 0)); -////} -//// -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__non_coinbase_strong_above__true) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); -//// BOOST_REQUIRE(query.set(test::tx4)); -//// -//// // Is not actually mature at height zero, but strong is presumed to always -//// // be set at the current height and never above it (set above in this test). -//// BOOST_REQUIRE(query.set_strong(1)); -//// BOOST_REQUIRE(query.is_mature(query.to_point(2, 0), 0)); -////} -//// -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__non_coinbase__true) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); -//// BOOST_REQUIRE(query.set(test::tx4)); -//// BOOST_REQUIRE(query.set_strong(1)); -//// BOOST_REQUIRE(query.is_mature(query.to_point(2, 0), 1)); -////} -//// -////BOOST_AUTO_TEST_CASE(query_confirmed__is_mature__coinbase__expected) -////{ -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.set(test::block1b, context{ 0, 1, 0 }, false, false)); -//// BOOST_REQUIRE(query.set_strong(1)); -//// BOOST_REQUIRE(query.set(test::tx2b)); -//// BOOST_REQUIRE(!query.is_mature(query.to_point(2, 0), 100)); -//// BOOST_REQUIRE(query.is_mature(query.to_point(2, 0), 101)); -////} - constexpr auto bip68 = system::chain::flags::bip68_rule; BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__bad_link__integrity_block_confirmable1) @@ -460,7 +378,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__bad_link__integrity_blo settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ bip68, 1, 0 }, false, false)); BOOST_REQUIRE_EQUAL(query.block_confirmable(2), error::integrity_block_confirmable1); @@ -475,7 +393,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__null_points__success) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{ bip68 }, false, false)); BOOST_REQUIRE(query.set(test::block2, context{ bip68 }, false, false)); @@ -496,7 +414,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__missing_prevouts__integ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1a, context{ bip68, 1, 0 }, false, false)); @@ -512,7 +430,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__spend_gensis__coinbase_ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block_spend_genesis spends the genesis output. @@ -530,7 +448,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__immature_prevouts__coin settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1b has only a coinbase tx. @@ -551,7 +469,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__mature_prevouts__succes settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1b has only a coinbase tx. @@ -572,7 +490,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__spend_non_coinbase__suc settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1a has non-coinbase tx/outputs. @@ -597,7 +515,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__spend_coinbase_and_inte settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1b has coinbase tx/outputs. @@ -622,7 +540,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__spend_coinbase_and_inte settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1b has coinbase tx/outputs. @@ -649,7 +567,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__confirmed_double_spend_ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1a has non-coinbase tx/outputs. @@ -674,7 +592,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__block_confirmable__unconfirmed_double_spen settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // block1a has non-coinbase tx/outputs. @@ -700,7 +618,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_all_prevouts__genesis__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.is_confirmed_all_prevouts(0)); } @@ -711,7 +629,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_all_prevouts__unconfirmed_coi settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // Block 1b has single null input so archived as (strong) coinbase. @@ -725,7 +643,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_all_prevouts__confirmed_coinb settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // Block 1b has single null input so archived as (strong) coinbase. @@ -740,7 +658,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_all_prevouts__missing_prevout settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // Tx1 is of block1a and consists of three inputs that do not exist. @@ -754,7 +672,7 @@ BOOST_AUTO_TEST_CASE(query_confirmed__is_confirmed_all_prevouts__prevouts_confir settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); // Block 1a has 1 tx(1) with 2 outputs. diff --git a/test/query/consensus/consensus_chain_state.cpp b/test/query/consensus/consensus_chain_state.cpp index 56c514311..d558e581d 100644 --- a/test/query/consensus/consensus_chain_state.cpp +++ b/test/query/consensus/consensus_chain_state.cpp @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(query_consensus__get_candidate_chain_state__genesis__expect database_settings.path = TEST_DIRECTORY; test::chunk_store store{ database_settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); const auto state = query.get_candidate_chain_state(system_settings); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(query_consensus__get_candidate_chain_state__block1__expecte database_settings.path = TEST_DIRECTORY; test::chunk_store store{ database_settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context, true, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::block1.hash()))); diff --git a/test/query/extent.cpp b/test/query/extent.cpp index f5c119fad..b2f81f1ea 100644 --- a/test/query/extent.cpp +++ b/test/query/extent.cpp @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(query_extent__body_sizes__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.header_body_size(), schema::header::minrow); @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(query_extent__buckets__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.header_buckets(), 128u); @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(query_extent__records__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.header_records(), one); @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(query_extent__input_output_count__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.input_count(0), one); @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(query_extent__optionals_enabled__default__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.address_enabled()); BOOST_REQUIRE(query.filter_enabled()); @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(query_extent__address_enabled__disabled__false) settings.address_buckets = 0; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(!query.address_enabled()); BOOST_REQUIRE(query.filter_enabled()); @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(query_extent__filter_enabled__disabled__false) settings.filter_tx_buckets = 0; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.address_enabled()); BOOST_REQUIRE(!query.filter_enabled()); diff --git a/test/query/filters.cpp b/test/query/filters.cpp index 5b4c735bf..15602e0ec 100644 --- a/test/query/filters.cpp +++ b/test/query/filters.cpp @@ -22,34 +22,4 @@ BOOST_FIXTURE_TEST_SUITE(query_filters_tests, test::directory_setup_fixture) -////BOOST_AUTO_TEST_CASE(query_filters__set_filter__get_filter_and_head__expected) -////{ -//// const auto& filter_head0 = system::null_hash; -//// const auto filter0 = system::base16_chunk("0102030405060708090a0b0c0d0e0f"); -//// const auto& filter_head1 = system::one_hash; -//// const auto filter1 = system::base16_chunk("102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0"); -//// -//// settings settings{}; -//// settings.path = TEST_DIRECTORY; -//// test::chunk_store store{ settings }; -//// test::query_accessor query{ store }; -//// BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); -//// BOOST_REQUIRE(query.initialize(test::genesis)); -//// BOOST_REQUIRE(query.set(test::block1a, context{}, false, false)); -//// BOOST_REQUIRE(query.set_filter(0, filter_head0, filter0)); -//// BOOST_REQUIRE(query.set_filter(1, filter_head1, filter1)); -//// -//// hash_digest head{}; -//// BOOST_REQUIRE(query.get_filter_head(head, 0)); -//// BOOST_REQUIRE_EQUAL(head, filter_head0); -//// BOOST_REQUIRE(query.get_filter_head(head, 1)); -//// BOOST_REQUIRE_EQUAL(head, filter_head1); -//// -//// system::data_chunk out{}; -//// BOOST_REQUIRE(query.get_filter(out, 0)); -//// BOOST_REQUIRE_EQUAL(out, filter0); -//// BOOST_REQUIRE(query.get_filter(out, 1)); -//// BOOST_REQUIRE_EQUAL(out, filter1); -////} - BOOST_AUTO_TEST_SUITE_END() diff --git a/test/query/height.cpp b/test/query/height.cpp index fe417bb2e..fcf581eb7 100644 --- a/test/query/height.cpp +++ b/test/query/height.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_candidate_hashes__initialized__one) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.get_candidate_hashes({ 0, 1, 2, 4, 6, 8 }).size(), 1u); } @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_candidate_hashes__gapped__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_hashes1__initialized__one) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.get_confirmed_hashes({ 0, 1, 2, 4, 6, 8 }).size(), 1u); } @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_hashes1__gapped__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_hashes2__various__expected_size settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_hashes2__three__ascending_order settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__empty__empty) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.get_confirmed_headers(0, 0).size(), 0u); BOOST_REQUIRE_EQUAL(query.get_confirmed_headers(0, 42).size(), 1u); @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__unconfirmeds__empty) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__confirmeds__expected_s settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__confirmeds__expected_h settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__over_top__reduced_coun settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -282,7 +282,7 @@ BOOST_AUTO_TEST_CASE(query_height__get_confirmed_headers__under_top__full_count) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); diff --git a/test/query/initialize.cpp b/test/query/initialize.cpp index 95657c7f3..aa4dae2ee 100644 --- a/test/query/initialize.cpp +++ b/test/query/initialize.cpp @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__initialize__is_initialized__true) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.is_initialized()); } @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__is_initialized__default__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(!query.is_initialized()); } @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__is_initialized__unconfirmed__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::genesis.hash()))); BOOST_REQUIRE(!query.is_initialized()); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__is_initialized__candidate__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::genesis.hash()))); BOOST_REQUIRE(!query.is_initialized()); @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__is_initialized__confirmed__false) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_confirmed(query.to_header(test::genesis.hash()), false)); BOOST_REQUIRE(!query.is_initialized()); @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__is_initialized__candidate_and_confirmed__ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::genesis.hash()))); BOOST_REQUIRE(query.push_confirmed(query.to_header(test::genesis.hash()), false)); @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top__genesis_confirmed__0) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_confirmed(query.to_header(test::genesis.hash()), false)); ////BOOST_REQUIRE(query.push_candidate(query.to_header(genesis.hash()))); @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top__three_blocks_confirmed__2) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top_candidate__genesis_candidated__0) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::genesis.hash()))); ////BOOST_REQUIRE(query.push_confirmed(query.to_header(test::genesis.hash()), false)); @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top__three_blocks_candidated__2) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_fork__initialized__0) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.push_candidate(query.to_header(test::genesis.hash()))); BOOST_REQUIRE(query.push_confirmed(query.to_header(test::genesis.hash()), false)); @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_fork__candidate_ahead__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_fork__confirmed_ahead__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.set(test::genesis, test::context, false, false)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top_associated_from__terminal__max_si settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.get_top_associated_from(max_size_t), max_size_t); BOOST_REQUIRE_EQUAL(query.get_top_associated_from(height_link::terminal), max_size_t); @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top_associated_from__initialized__zer settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.get_top_associated(), 0u); BOOST_REQUIRE_EQUAL(query.get_top_associated_from(0), 0u); @@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top_associated_from__non_candidate__e settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_top_associated_from__gapped_candidate settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2.header(), test::context, false)); // header only @@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_unassociated_above__initialized__empt settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.get_all_unassociated().empty()); BOOST_REQUIRE(query.get_unassociated_above(0).empty()); @@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_unassociated_above__gapped_candidate_ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); constexpr database::context context2 { @@ -435,7 +435,7 @@ BOOST_AUTO_TEST_CASE(query_initialize__get_unassociated_count_above__gapped_cand settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); constexpr database::context context2 { diff --git a/test/query/navigate/navigate_arraymap.cpp b/test/query/navigate/navigate_arraymap.cpp index 7a36bb652..918e88e63 100644 --- a/test/query/navigate/navigate_arraymap.cpp +++ b/test/query/navigate/navigate_arraymap.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_txs__multiple__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); diff --git a/test/query/navigate/navigate_forward.cpp b/test/query/navigate/navigate_forward.cpp index c33c075be..b5eb8b2ee 100644 --- a/test/query/navigate/navigate_forward.cpp +++ b/test/query/navigate/navigate_forward.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_output__various__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_coinbase__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE_EQUAL(query.to_header(test::genesis.hash()), header_link::terminal); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.to_coinbase(0), 0u); diff --git a/test/query/navigate/navigate_natural.cpp b/test/query/navigate/navigate_natural.cpp index 6913e7a97..6c3913a5e 100644 --- a/test/query/navigate/navigate_natural.cpp +++ b/test/query/navigate/navigate_natural.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_candidate__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); // initialize pushes the genesis candidate. BOOST_REQUIRE(query.initialize(test::genesis)); @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_confirmed__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); // initialize pushes the genesis confirmed. BOOST_REQUIRE(query.initialize(test::genesis)); @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_header__always__expected) test::query_accessor query{ store }; header_link link{}; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE_EQUAL(query.to_header(test::genesis.hash()), header_link::terminal); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE_EQUAL(query.to_header(test::genesis.hash()), 0u); @@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_tx__transactions__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); diff --git a/test/query/navigate/navigate_reverse.cpp b/test/query/navigate/navigate_reverse.cpp index b32170706..f4804442a 100644 --- a/test/query/navigate/navigate_reverse.cpp +++ b/test/query/navigate/navigate_reverse.cpp @@ -30,12 +30,12 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_parent__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); + BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block2, context{ 0, 2, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block2a, context{ 0, 2, 0 }, false, false)); BOOST_REQUIRE_EQUAL(query.to_parent(0), header_link::terminal); BOOST_REQUIRE_EQUAL(query.to_parent(1), 0u); BOOST_REQUIRE_EQUAL(query.to_parent(2), 1u); @@ -46,19 +46,14 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_parent__always__expected) // to_touched_txs1 -BOOST_AUTO_TEST_CASE(query_navigate__to_touched_txs1__galways__expected) +BOOST_AUTO_TEST_CASE(query_navigate__to_touched_txs1__always__expected) { settings settings{}; settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); - BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::tx4)); - BOOST_REQUIRE(query.set(test::tx5)); - BOOST_REQUIRE(query.set(test::block3a, test::context, false, false)); + BOOST_REQUIRE(!store.create(test::events_handler)); + BOOST_REQUIRE(setup_three_block_unconfirmed_address_store(query)); output_links links{}; BOOST_REQUIRE(!query.to_address_outputs(links, test::block1a_address1)); @@ -84,13 +79,8 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_touched_txs2__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); - BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::tx4)); - BOOST_REQUIRE(query.set(test::tx5)); - BOOST_REQUIRE(query.set(test::block3a, test::context, false, false)); + BOOST_REQUIRE(!store.create(test::events_handler)); + BOOST_REQUIRE(setup_three_block_unconfirmed_address_store(query)); output_links links{}; const std::atomic_bool cancel{}; @@ -125,13 +115,8 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_address_outputs1__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); - BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::tx4)); - BOOST_REQUIRE(query.set(test::tx5)); - BOOST_REQUIRE(query.set(test::block3a, test::context, false, false)); + BOOST_REQUIRE(!store.create(test::events_handler)); + BOOST_REQUIRE(setup_three_block_unconfirmed_address_store(query)); output_links out{}; BOOST_REQUIRE(!query.to_address_outputs(out, test::block1a_address1)); @@ -149,13 +134,8 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_address_outputs2__always__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); - BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::tx4)); - BOOST_REQUIRE(query.set(test::tx5)); - BOOST_REQUIRE(query.set(test::block3a, test::context, false, false)); + BOOST_REQUIRE(!store.create(test::events_handler)); + BOOST_REQUIRE(setup_three_block_unconfirmed_address_store(query)); output_links out{}; const std::atomic_bool cancel{}; @@ -180,12 +160,12 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_output_tx__to_output__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block3, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); + BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block2, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block3, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); // All 5 blocks have one transaction with 1 output. BOOST_REQUIRE_EQUAL(query.to_output_tx(0 * 0x51), 0u); @@ -247,10 +227,10 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_prevout_tx__to_prevout__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1a, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2a, test::context, false, false)); + BOOST_REQUIRE(query.set(test::block1a, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block2a, context{ 0, 1, 0 }, false, false)); // inputs in link order. BOOST_REQUIRE_EQUAL(query.to_prevout_tx(0), tx_link::terminal); @@ -301,10 +281,10 @@ BOOST_AUTO_TEST_CASE(query_navigate__to_block__always__expected) }; accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); - BOOST_REQUIRE(query.set(test::block1, test::context, false, false)); - BOOST_REQUIRE(query.set(test::block2, test::context, false, false)); + BOOST_REQUIRE(query.set(test::block1, context{ 0, 1, 0 }, false, false)); + BOOST_REQUIRE(query.set(test::block2, context{ 0, 1, 0 }, false, false)); // Either not strong or not found, except genesis. BOOST_REQUIRE(!query.to_block(0).is_terminal()); diff --git a/test/query/properties_block.cpp b/test/query/properties_block.cpp index db21fa726..b94d90ff9 100644 --- a/test/query/properties_block.cpp +++ b/test/query/properties_block.cpp @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_top_timestamp__always__expected settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); BOOST_REQUIRE(query.set(test::block2, context{}, false, false)); @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_timestamp__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); uint32_t timestamp{}; @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_version__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); uint32_t version{}; @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_bits__genesis__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); uint32_t bits{}; @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_context__genesis__default) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); context ctx{}; @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_context__invalid__default) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); context ctx{}; @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_context__block1__expected) settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); const context expected{ 12, 34, 56 }; @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__invalid_link__unas settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); uint64_t fees{}; @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__unassociated_link_ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1.header(), context{}, false)); BOOST_REQUIRE(query.set(*test::block1.transactions_ptr()->front())); @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__unvalidated_link__ settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__confirmable__block settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); @@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__valid__block_valid settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); @@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(query_properties_block__get_block_state__unconfirmable__blo settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); diff --git a/test/query/properties_tx.cpp b/test/query/properties_tx.cpp index 10e5e3861..549e3742e 100644 --- a/test/query/properties_tx.cpp +++ b/test/query/properties_tx.cpp @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(query_properties_tx__get_tx_state__invalid_link__unvalidate settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); uint64_t fee{}; @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(query_properties_tx__get_tx_state__unvalidated__unvalidated settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(query_properties_tx__get_tx_state__connected_out_of_context settings.validated_tx_buckets = 1; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); BOOST_REQUIRE(query.set(test::block2, context{}, false, false)); @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(query_properties_tx__get_tx_state__connected_in_context__tx settings.validated_tx_buckets = 1; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); BOOST_REQUIRE(query.set(test::block2, context{}, false, false)); @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(query_properties_tx__get_tx_state__connected_in_context__tx settings.path = TEST_DIRECTORY; test::chunk_store store{ settings }; test::query_accessor query{ store }; - BOOST_REQUIRE_EQUAL(store.create(test::events_handler), error::success); + BOOST_REQUIRE(!store.create(test::events_handler)); BOOST_REQUIRE(query.initialize(test::genesis)); BOOST_REQUIRE(query.set(test::block1, context{}, false, false)); BOOST_REQUIRE(query.set(test::block2, context{}, false, false));