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
39 changes: 37 additions & 2 deletions console/executor_test_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,43 @@ using namespace network;
using namespace system;
using format = boost_format;

// address index conflict walk (const).

void executor::read_test(const hash_digest& key) const
{
if (!query_.address_enabled())
{
logger("Address index is disabled.");
return;
}

logger("Address conflict walk.");
const auto start = fine_clock::now();

// Candidates are all rows on the key's chain, matches are verified.
size_t candidates{};
for (auto it = store_.outs.it({ key }); it; ++it)
++candidates;

const auto walk = duration_cast<milliseconds>(fine_clock::now() - start);

database::output_links out{};
if (const auto ec = query_.to_address_outputs(out, key))
{
logger(format("Address (%1%) failed with (%2%).") %
encode_hash(key) % ec.message());
return;
}

const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Address (%1%) candidates (%2%) matches (%3%) conflicts "
"(%4%) walk (%5%) ms total (%6%) ms.") % encode_hash(key) %
candidates % out.size() % (candidates - out.size()) %
walk.count() % span.count());
}

#if defined(UNDEFINED)

// arbitrary testing (const).

void executor::read_test(const hash_digest&) const
Expand Down Expand Up @@ -66,8 +103,6 @@ void executor::read_test(const hash_digest&) const
size % top % span.count());
}

#if defined(UNDEFINED)

void executor::read_test(const hash_digest&) const
{
logger(format("Ins table body searches: %1% / (%2% + %1%)") %
Expand Down
4 changes: 3 additions & 1 deletion include/bitcoin/server/protocols/protocol_native.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BCS_API protocol_native
const network::channel::ptr& channel,
const options_t& options) NOEXCEPT
: protocol_html(session, channel, options),
turbo_(session->database_settings().turbo),
notification_strand_(channel->service().get_executor()),
network::tracker<protocol_native>(session->log)
{
Expand Down Expand Up @@ -250,8 +251,9 @@ class BCS_API protocol_native
database::header_link to_header(const std::optional<uint32_t>& height,
const std::optional<system::hash_cptr>& hash) NOEXCEPT;

// This is thread safe, uses network threadpool.
// These are thread safe, strand uses network threadpool.
network::asio::strand notification_strand_;
const bool turbo_;

// These are thread safe.
std::atomic_bool stopping_{};
Expand Down
Loading
Loading