@@ -470,14 +470,37 @@ BOOST_AUTO_TEST_CASE(query_archive_read__get_tx_count__coinbase__1)
470470 BOOST_REQUIRE_EQUAL (query.get_tx_count (0 ), 1u );
471471}
472472
473+ BOOST_AUTO_TEST_CASE (query_archive_read__get_witness__not_found__nullptr)
474+ {
475+ settings settings{};
476+ settings.path = TEST_DIRECTORY;
477+ test::chunk_store store{ settings };
478+ test::query_accessor query{ store };
479+ BOOST_REQUIRE (!store.create (events_handler));
480+ BOOST_REQUIRE (!query.get_witness (query.to_point ({}, {})));
481+ BOOST_REQUIRE (!store.close (events_handler));
482+ }
483+
484+ BOOST_AUTO_TEST_CASE (query_archive_read__get_input_script__not_found__nullptr)
485+ {
486+ settings settings{};
487+ settings.path = TEST_DIRECTORY;
488+ test::chunk_store store{ settings };
489+ test::query_accessor query{ store };
490+ BOOST_REQUIRE (!store.create (events_handler));
491+ BOOST_REQUIRE (!query.get_input_script (query.to_point (tx_link{}, {})));
492+ BOOST_REQUIRE (!store.close (events_handler));
493+ }
494+
473495BOOST_AUTO_TEST_CASE (query_archive_read__get_input__not_found__nullptr)
474496{
475497 settings settings{};
476498 settings.path = TEST_DIRECTORY;
477499 test::chunk_store store{ settings };
478500 test::query_accessor query{ store };
479501 BOOST_REQUIRE (!store.create (events_handler));
480- BOOST_REQUIRE (!query.get_input (query.to_tx (system::null_hash), 0u , false ));
502+ BOOST_REQUIRE (!query.get_input (query.to_point (tx_link{}, {}), false ));
503+ BOOST_REQUIRE (!query.get_input (query.to_tx (system::null_hash), {}, false ));
481504 BOOST_REQUIRE (!store.close (events_handler));
482505}
483506
@@ -495,8 +518,10 @@ BOOST_AUTO_TEST_CASE(query_archive_read__get_input__genesis__expected)
495518
496519 const auto tx = test::genesis.transactions_ptr ()->front ();
497520 const auto input = tx->inputs_ptr ()->front ();
498- // // BOOST_REQUIRE(*input == *query.get_input(query.to_tx(tx->hash(false)), 0u));
499- // // BOOST_REQUIRE(*input == *query.get_input(0));
521+ const auto point = query.to_point (query.to_tx (tx->hash (false )), 0u );
522+ BOOST_REQUIRE (*input == *query.get_input (point, false ));
523+ BOOST_REQUIRE (input->witness () == *query.get_witness (point));
524+ BOOST_REQUIRE (input->script () == *query.get_input_script (point));
500525}
501526
502527BOOST_AUTO_TEST_CASE (query_archive_read__get_inputs__tx_not_found__nullptr)
@@ -522,6 +547,18 @@ BOOST_AUTO_TEST_CASE(query_archive_read__get_inputs__found__expected)
522547 BOOST_REQUIRE_EQUAL (query.get_inputs (1 , false )->size (), 2u );
523548}
524549
550+ BOOST_AUTO_TEST_CASE (query_archive_read__get_output_script__not_found__nullptr)
551+ {
552+ settings settings{};
553+ settings.path = TEST_DIRECTORY;
554+ test::chunk_store store{ settings };
555+ test::query_accessor query{ store };
556+ BOOST_REQUIRE (!store.create (events_handler));
557+ BOOST_REQUIRE (!query.get_output_script (query.to_output (system::null_hash, 0u )));
558+ BOOST_REQUIRE (!query.get_output (0 ));
559+ BOOST_REQUIRE (!store.close (events_handler));
560+ }
561+
525562BOOST_AUTO_TEST_CASE (query_archive_read__get_output__not_found__nullptr)
526563{
527564 settings settings{};
@@ -530,7 +567,7 @@ BOOST_AUTO_TEST_CASE(query_archive_read__get_output__not_found__nullptr)
530567 test::query_accessor query{ store };
531568 BOOST_REQUIRE (!store.create (events_handler));
532569 BOOST_REQUIRE (!query.get_output (query.to_tx (system::null_hash), 0u ));
533- BOOST_REQUIRE (!query.get_output (query.to_output (system::chain::point{ system:: null_hash, 0u } )));
570+ BOOST_REQUIRE (!query.get_output (query.to_output (system::null_hash, 0u )));
534571 BOOST_REQUIRE (!query.get_output (0 ));
535572 BOOST_REQUIRE (!store.close (events_handler));
536573}
@@ -548,10 +585,11 @@ BOOST_AUTO_TEST_CASE(query_archive_read__get_output__genesis__expected)
548585 BOOST_REQUIRE (query.set (test::genesis, test::context, false , false ));
549586
550587 const auto tx = test::genesis.transactions_ptr ()->front ();
551- const auto output1 = tx->outputs_ptr ()->front ();
552- BOOST_REQUIRE (*output1 == *query.get_output (query.to_tx (tx->hash (false )), 0u ));
553- BOOST_REQUIRE (*output1 == *query.get_output (query.to_output (tx->hash (false ), 0u )));
554- BOOST_REQUIRE (*output1 == *query.get_output (0 ));
588+ const auto output = tx->outputs_ptr ()->front ();
589+ BOOST_REQUIRE (*output == *query.get_output (0 ));
590+ BOOST_REQUIRE (*output == *query.get_output (query.to_tx (tx->hash (false )), 0u ));
591+ BOOST_REQUIRE (*output == *query.get_output (query.to_output (tx->hash (false ), 0u )));
592+ BOOST_REQUIRE (output->script () == *query.get_output_script (query.to_output (tx->hash (false ), 0u )));
555593}
556594
557595BOOST_AUTO_TEST_CASE (query_archive_read__get_outputs__tx_not_found__nullptr)
0 commit comments