Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions console/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class executor
bool do_slabs();
bool do_buckets();
bool do_collisions();
bool do_read();
bool do_write();
bool do_read(const system::hash_digest& hash);
bool do_write(const system::hash_digest& hash);

// Runtime options.
void do_hot_backup();
Expand All @@ -126,8 +126,8 @@ class executor
void subscribe_capture();

// Built in tests.
void read_test(bool dump) const;
void write_test(bool dump);
void read_test(const system::hash_digest& hash) const;
void write_test(const system::hash_digest& hash);

// Logging.
database::file::stream::out::rotator create_log_sink() const;
Expand Down
22 changes: 11 additions & 11 deletions console/executor_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,26 @@ bool executor::do_collisions()
}

// --[t]read
bool executor::do_read()
bool executor::do_read(const system::hash_digest& hash)
{
log_.stop();
if (!check_store_path() ||
!open_store())
return false;

read_test(true);
read_test(hash);
return close_store();
}

// --[w]rite
bool executor::do_write()
bool executor::do_write(const system::hash_digest& hash)
{
log_.stop();
if (!check_store_path() ||
!open_store())
return false;

write_test(true);
write_test(hash);
return close_store();
}

Expand All @@ -210,6 +210,9 @@ bool executor::dispatch()
if (config.backup)
return do_backup();

if (config.restore)
return do_restore();

if (config.hardware)
return do_hardware();

Expand All @@ -228,20 +231,17 @@ bool executor::dispatch()
if (config.information)
return do_information();

if (config.test)
return do_read();

if (config.settings)
return do_settings();

if (config.version)
return do_version();

if (config.write)
return do_write();
if (config.test != system::null_hash)
return do_read(config.test);

if (config.restore)
return do_restore();
if (config.write != system::null_hash)
return do_write(config.write);

return do_run();
}
Expand Down
2 changes: 1 addition & 1 deletion console/executor_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void executor::do_menu() const
// [t]est
void executor::do_test() const
{
read_test(false);
read_test(system::null_hash);
}

// [w]ork
Expand Down
25 changes: 13 additions & 12 deletions console/executor_test_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace network;
using namespace system;

// arbitrary testing (const).
void executor::read_test(bool) const
void executor::read_test(const hash_digest&) const
{
logger(format("Point table body searches: %1% / (%2% + %1%)") %
store_.point.positive_search_count() %
Expand All @@ -40,11 +40,12 @@ void executor::read_test(bool) const

#if defined(UNDEFINED)

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
using namespace database;
constexpr auto start_tx = 1'000'000_u32;
constexpr auto target_count = 100_size;
constexpr auto dump{ false };

// Set ensures unique addresses.
std::set<hash_digest> keys{};
Expand Down Expand Up @@ -271,15 +272,15 @@ void executor::read_test(bool dump) const
}
}

void executor::read_test(bool) const
void executor::read_test(const hash_digest&) const
{
database::header_link link{ 350'017_u32 };
const auto ec = query_.block_confirmable(link);
logger(format("block_confirmable [%1%] at height [%2%].") % ec.message() %
query_.get_height(link));
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
Expand Down Expand Up @@ -310,7 +311,7 @@ void executor::read_test(bool dump) const
size % last % span.count());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
auto start = fine_clock::now();
auto count = query_.header_records();
Expand Down Expand Up @@ -350,7 +351,7 @@ void executor::read_test(bool dump) const
logger(format("Top strong tx is [%1%] in [%2%] ms.") % sub1(tx) % span.count());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
const auto from = 481'824_u32;
const auto top = 840'000_u32; ////query_.get_top_associated();
Expand All @@ -376,7 +377,7 @@ void executor::read_test(bool dump) const
% total % top % average % span.count());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
// Binance wallet address with 1,380,169 transaction count.
// blockstream.info/address/bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h
Expand All @@ -398,7 +399,7 @@ void executor::read_test(bool dump) const
// This was caused by concurrent redundant downloads at tail following restart.
// The earlier transactions were marked as confirmed and during validation the
// most recent are found via point.hash association priot to to_block() test.
void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
const auto height = 839'287_size;
const auto block = query_.to_confirmed(height);
Expand Down Expand Up @@ -570,7 +571,7 @@ void executor::read_test(bool dump) const
logger(format("Confirm [%1%] test (%2%).") % height % ec.message());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
const auto bk_link = query_.to_candidate(804'001_size);
const auto block = query_.get_block(bk_link);
Expand Down Expand Up @@ -627,7 +628,7 @@ void executor::read_test(bool dump) const
logger(format("Confirm test 2 complete (%1%).") % ec.message());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
using namespace database;
constexpr auto frequency = 100'000u;
Expand Down Expand Up @@ -683,7 +684,7 @@ void executor::read_test(bool dump) const
logger(format("get_transaction" BN_READ_ROW) % tx % span.count());
}

void executor::read_test(bool dump) const
void executor::read_test(const hash_digest&) const
{
constexpr auto hash492224 = base16_hash(
"0000000000000000003277b639e56dffe2b4e60d18aeedb1fe8b7e4256b2a526");
Expand Down Expand Up @@ -806,7 +807,7 @@ void executor::read_test(bool dump) const
}

// TODO: create a block/tx dumper.
void executor::read_test(bool) const
void executor::read_test(const hash_digest&) const
{
constexpr auto link = 600'000_size;
const auto start = logger::now();
Expand Down
12 changes: 6 additions & 6 deletions console/executor_test_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ using namespace network;
using namespace system;

// arbitrary testing (non-const).
void executor::write_test(bool)
void executor::write_test(const hash_digest&)
{
logger("No write test implemented.");
}

#if defined(UNDEFINED)

void executor::write_test(bool)
void executor::write_test(const system::hash_digest&)
{
for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link)
{
Expand All @@ -51,7 +51,7 @@ void executor::write_test(bool)
logger(format("set_block_unknown complete."));
}

void executor::write_test(bool)
void executor::write_test(const system::hash_digest&)
{
code ec{};
size_t count{};
Expand Down Expand Up @@ -97,7 +97,7 @@ void executor::write_test(bool)
span.count());
}

void executor::write_test(bool)
void executor::write_test(const system::hash_digest&)
{
using namespace database;
constexpr auto frequency = 10'000;
Expand Down Expand Up @@ -134,7 +134,7 @@ void executor::write_test(bool)
logger(format("block" BN_WRITE_ROW) % height % span.count());
}

void executor::write_test(bool)
void executor::write_test(const system::hash_digest&)
{
using namespace database;
////constexpr uint64_t fees = 99;
Expand Down Expand Up @@ -201,7 +201,7 @@ void executor::write_test(bool)
logger(format("block" BN_WRITE_ROW) % height % span.count());
}

void executor::write_test(bool)
void executor::write_test(const system::hash_digest&)
{
constexpr auto hash251684 = base16_hash(
"00000000000000720e4c59ad28a8b61f38015808e92465e53111e3463aed80de");
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class BCN_API configuration
bool collisions{};

/// Ad-hoc Testing.
bool test{};
bool write{};
system::config::hash256 test{};
system::config::hash256 write{};

/// Settings.
log::settings log;
Expand Down
4 changes: 3 additions & 1 deletion include/bitcoin/node/protocols/protocol_explore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_EXPLORE_HPP
#define LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_EXPLORE_HPP

#include <atomic>
#include <memory>
#include <optional>
#include <bitcoin/node/define.hpp>
Expand Down Expand Up @@ -95,7 +96,7 @@ class BCN_API protocol_explore
bool handle_get_tx(const code& ec, interface::tx,
uint8_t version, uint8_t media, const system::hash_cptr& hash,
bool witness) NOEXCEPT;
bool handle_get_tx_block(const code& ec, interface::tx_block,
bool handle_get_tx_header(const code& ec, interface::tx_header,
uint8_t version, uint8_t media,
const system::hash_cptr& hash) NOEXCEPT;
bool handle_get_tx_fee(const code& ec, interface::tx_fee,
Expand Down Expand Up @@ -152,6 +153,7 @@ class BCN_API protocol_explore
const std::optional<system::hash_cptr>& hash) NOEXCEPT;

dispatcher dispatcher_{};
std::atomic_bool stopping_{};
};

} // namespace node
Expand Down
4 changes: 2 additions & 2 deletions src/parse/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ code parse_target(request_t& out, const std::string_view& path) NOEXCEPT
else
{
const auto component = segments[segment++];
if (component == "block")
method = "tx_block";
if (component == "header")
method = "tx_header";
else if (component == "fee")
method = "tx_fee";
else
Expand Down
8 changes: 4 additions & 4 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ options_metadata parser::load_options() THROWS
// Ad-hoc Testing.
(
BN_READ_VARIABLE ",t",
value<bool>(&configured.test)->
default_value(false)->zero_tokens(),
value<config::hash256>(&configured.test)->
default_value(system::null_hash),
"Run built-in read test and display."
)
(
BN_WRITE_VARIABLE ",w",
value<bool>(&configured.write)->
default_value(false)->zero_tokens(),
value<config::hash256>(&configured.write)->
default_value(system::null_hash),
"Run built-in write test and display."
);

Expand Down
Loading
Loading