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
2 changes: 1 addition & 1 deletion include/bitcoin/node/chasers/chaser_transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class BCN_API chaser_transaction
std::vector<bool> stored{};
std::vector<size_t> sigops_of{};
std::unordered_set<system::hash_digest> held{};
query::pool_graph graph{};
database::pool_graph graph{};
uint64_t weight{};
uint64_t sigops{};
size_t given{};
Expand Down
7 changes: 4 additions & 3 deletions src/chasers/chaser_confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ bool chaser_confirm::notify_block(const code& ec, size_t height,
// CONFIRMABLE BLOCK
notify(error::success, chases::confirmable{ link });
fire(events::block_confirmed, height);
LOGV("Block confirmed: " << height << (bypass ? " (bypass)" : ""));
LOGV("Block confirmed [" << height << "]"
<< (bypass ? " (bypass)" : "") << ".");
return true;
}

Expand All @@ -409,7 +410,7 @@ bool chaser_confirm::set_reorganized(const header_link& link,
notify(error::success, chases::reorganized{ link });
broadcast(link, false);
fire(events::block_reorganized, confirmed_height);
LOGV("Block reorganized: " << confirmed_height);
LOGV("Block reorganized [" << confirmed_height << "].");
return true;
}

Expand Down Expand Up @@ -443,7 +444,7 @@ bool chaser_confirm::set_organized(const header_link& link,
notify(error::success, chases::organized{ link });
broadcast(link, true);
fire(events::block_organized, confirmed_height);
LOGV("Block organized: " << confirmed_height);
LOGV("Block organized [" << confirmed_height << "].");
fire_top(confirmed_height);

if (confirmed_height == maximum_height_)
Expand Down
2 changes: 1 addition & 1 deletion src/chasers/chaser_download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ code chaser_download::start() NOEXCEPT
set_position(archive().get_fork());
requested_ = advanced_ = position();
const auto added = set_unassociated();
LOGN("Fork point (" << requested_ << ") unassociated (" << added << ").");
LOGV("Fork point (" << requested_ << ") unassociated (" << added << ").");

SUBSCRIBE_CHASE(handle_chase, _1, _2);
return error::success;
Expand Down
14 changes: 7 additions & 7 deletions src/chasers/chaser_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ bool chaser_header::set_reorganized(height_t candidate_height) NOEXCEPT
return false;

fire(events::header_reorganized, candidate_height);
LOGV("Header reorganized: " << candidate_height);
LOGV("Header reorganized [" << candidate_height << "].");
return true;
}

Expand Down Expand Up @@ -643,7 +643,7 @@ bool chaser_header::set_organized(const header_link& link,
return false;

fire(events::header_organized, candidate_height);
LOGV("Header organized: " << candidate_height);
LOGV("Header organized [" << candidate_height << "].");
return true;
}

Expand All @@ -660,7 +660,7 @@ code chaser_header::push_header(header_link& link, const header& header,
return ec;

fire(events::header_archived, ctx.height);
LOGV("Header archived: " << ctx.height);
LOGV("Header archived [" << ctx.height << "].");
return set_organized(link, ctx.height) ? error::success : error::organize14;
}

Expand Down Expand Up @@ -795,7 +795,7 @@ void chaser_header::prune_tree(const uint256_t& threshold) NOEXCEPT

if (!is_zero(count))
{
LOGN("Purged (" << count << ") headers under window at ["
LOGV("Purged (" << count << ") headers under window at ["
<< state_->height() << "].");
}
}
Expand Down Expand Up @@ -825,7 +825,7 @@ void chaser_header::prune_tree() NOEXCEPT

if (!is_zero(count))
{
LOGN("Purged (" << count << ") headers under checkpoint ["
LOGV("Purged (" << count << ") headers under checkpoint ["
<< active_checkpoint_ << "].");
}
}
Expand Down Expand Up @@ -941,15 +941,15 @@ void chaser_header::log_state_change(const chain_state& from,
LOGN("Fork flags changed from ["
<< prev << "] to ["
<< next << "] at ["
<< to.height() << ":" << encode_hash(to.hash()) << "].");
<< encode_hash(to.hash()) << ":" << to.height() << "].");
}

if (from.minimum_block_version() != to.minimum_block_version())
{
LOGN("Minimum block version changed from ["
<< from.minimum_block_version() << "] to ["
<< to.minimum_block_version() << "] at ["
<< to.height() << ":" << encode_hash(to.hash()) << "].");
<< encode_hash(to.hash()) << ":" << to.height() << "].");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/chasers/chaser_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void chaser_snapshot::do_trim() NOEXCEPT
{
// Trim may fail due to chain not coalesced following suspend, in which
// case trimming is attempted on announce until success.
LOGF("Trim deferred, " << ec.message());
LOGN("Trim deferred, " << ec.message());

if (running && ec == database::error::not_coalesced)
resume();
Expand Down
98 changes: 37 additions & 61 deletions src/chasers/chaser_transaction_submit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,69 +40,46 @@ BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR)
// First measured component over a limit, its check, counts and members
// (K candidate, otherwise pooled wtxid).
static std::string describe_limit(const node::query& query,
const node::query::pool_graph& graph, size_t given,
const database::pool_graph& graph, size_t given,
const pool::algorithm::totals_t& limit, size_t maximum_outcomes) NOEXCEPT
{
using algorithm = pool::algorithm;
const auto& g = graph.graph;
const auto rows = g.table.cells.size();
const auto members = [&](const algorithm::component_t& component)
NOEXCEPT
using check = database::pool_limit::check;
database::pool_limit over{};
if (const auto ec = query.get_pool_limit(over, graph, given, limit,
maximum_outcomes))
return ec.message();

if (over.failed == check::none)
return "no component over a limit";

std::ostringstream members{};
const auto& component = over.component;
for (size_t at{}; at < component.count; ++at)
{
std::ostringstream out{};
for (size_t at{}; at < component.count; ++at)
{
const auto row = component.rows[at];
if (row >= rows)
{
out << " K" << (row - rows);
continue;
}

out << " " << encode_hash(query.get_wtxid_key(
database::pool_link{ row }));
}

return out.str();
};

std::ostringstream out{};
for (auto at = given; at < graph.candidates.size(); ++at)
{
algorithm::component_t component{};
const auto candidate = graph.candidates.at(at);
if (!algorithm::collect(component, g, candidate))
{
out << "candidate " << at << " collect over "
<< algorithm::maximum_members << " members:"
<< members(component);
return out.str();
}

if (!algorithm::relate(component, g))
{
out << "candidate " << at << " relate over "
<< algorithm::maximum_members << " contests, members "
<< component.count << ":" << members(component);
return out.str();
}

algorithm::totals_t sum{};
const auto ancestry = is_zero(component.contests) ||
algorithm::ancestry(sum, g, component, limit);
const auto outcomes = algorithm::outcomes(component);
if (!ancestry || is_zero(maximum_outcomes))
{
out << "candidate " << at << (ancestry ? " outcomes " :
" ancestry ") << "members " << component.count
<< " contests " << component.contests << " outcomes "
<< outcomes << " weight " << sum.weight << " sigops "
<< sum.sigops << ":" << members(component);
return out.str();
}
const auto row = component.rows.at(at);
if (row >= graph.table_rows)
members << " K" << (row - graph.table_rows);
else
members << " " << encode_hash(over.wtxids.at(at));
}

return "no component over a limit";
std::ostringstream out{};
out << "candidate " << over.candidate;
if (over.failed == check::collect)
out << " collect over " << algorithm::maximum_members << " members:";
else if (over.failed == check::relate)
out << " relate over " << algorithm::maximum_members
<< " contests, members " << component.count << ":";
else
out << (over.failed == check::outcomes ? " outcomes " : " ancestry ")
<< "members " << component.count << " contests "
<< component.contests << " outcomes " << over.outcomes
<< " weight " << over.sum.weight << " sigops " << over.sum.sigops
<< ":";

out << members.str();
return out.str();
}

void chaser_transaction::submit(const transactions_cptr& txs, bool test,
Expand Down Expand Up @@ -471,8 +448,8 @@ code chaser_transaction::extend(bool& covered, submission& set,
const auto limit = block_limit();
if (set.weight > limit.weight || set.sigops > limit.sigops)
{
LOGN("Pool limit [" << encode_hash(tx.get_hash(false))
<< "] running set over a block");
LOGP("Pool limit [" << encode_hash(tx.get_hash(false))
<< "] running set over a block.");
return database::error::pool_limit;
}

Expand All @@ -485,7 +462,7 @@ code chaser_transaction::extend(bool& covered, submission& set,
report(pool_scan::coverage, start);
if (ec == database::error::pool_limit)
{
LOGN("Pool limit [" << encode_hash(tx.get_hash(false)) << "] "
LOGP("Pool limit [" << encode_hash(tx.get_hash(false)) << "] "
<< describe_limit(query, set.graph, set.given, limit,
settings.maximum_outcomes));
return ec;
Expand Down Expand Up @@ -530,7 +507,6 @@ code chaser_transaction::restore(submission& set, size_t index) NOEXCEPT
code chaser_transaction::clear(size_t& at, submission& set,
size_t index) NOEXCEPT
{
// The graph holds accessors, released before the index is written.
if (set.test)
set.given = set.graph.candidates.size();
else
Expand Down
3 changes: 2 additions & 1 deletion src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ void chaser_validate::notify_block(const code& ec, size_t height,
if (!startup)
notify(ec, chases::valid{ possible_wide_cast<height_t>(height) });
fire(events::block_validated, height);
LOGV("Block validated: " << height << (bypass ? " (bypass)" : ""));
LOGV("Block validated [" << height << "]"
<< (bypass ? " (bypass)" : "") << ".");
}

// Overrides due to independent priority thread pool
Expand Down
10 changes: 5 additions & 5 deletions src/chasers/chaser_validate_capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
void chaser_validate::do_log(const script& ) NOEXCEPT
{
// Enable for a game of whack-a-mole.
////LOGA("Sigop @ " << ctx.height << " -> "
////LOGV("Sigop @ " << ctx.height << " -> "
//// << missed.to_string(flags::all_rules));
}

Expand Down Expand Up @@ -160,13 +160,13 @@ std::string chaser_validate::log_ratio(const std::string& name,

void chaser_validate::log_captures() const NOEXCEPT
{
LOGN(log_ratio("Capture ecdsa....", counters_.ecdsa_,
LOGV(log_ratio("Capture ecdsa....", counters_.ecdsa_,
counters_.ecdsa_ + counters_.missed_ecdsa_));
LOGN(log_ratio("Capture multisig.", counters_.multisig_,
LOGV(log_ratio("Capture multisig.", counters_.multisig_,
counters_.multisig_ + counters_.missed_multisig_));
LOGN(log_ratio("Capture schnorr..", counters_.schnorr_,
LOGV(log_ratio("Capture schnorr..", counters_.schnorr_,
counters_.schnorr_ + counters_.missed_schnorr_));
LOGN(log_ratio("Capture threshold", counters_.threshold_,
LOGV(log_ratio("Capture threshold", counters_.threshold_,
counters_.threshold_ + counters_.missed_threshold_));
}

Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_validate_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ void chaser_validate::validate_block(const header_link& link,

if (pooled)
{
LOGN("Validated pooled block [" << ctx.height << "] of ("
LOGV("Validated pooled block [" << ctx.height << "] of ("
<< query.get_tx_count(link) << ") txs" << timed);
}
else
{
LOGN("Validated full block [" << ctx.height << "] of ("
LOGV("Validated full block [" << ctx.height << "] of ("
<< query.get_tx_count(link) << ") txs with ("
<< unpooled_count(query, link, ctx) << ") unpooled"
<< timed);
Expand Down
4 changes: 2 additions & 2 deletions src/full_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ bool full_node::resume() NOEXCEPT
return false;
}

LOGS("Resuming network.");
LOGN("Resuming network.");
const auto resumed = net::resume();
notify(error::success, chases::resume{});
return resumed;
Expand All @@ -410,7 +410,7 @@ bool full_node::resume() NOEXCEPT
// This is just a best effort, the call may have to be repeated.
void full_node::suspend(const code& ec) NOEXCEPT
{
LOGS("Suspending network, " << ec.message());
LOGN("Suspending network, " << ec.message());
net::suspend(ec);
notify(error::suspended_channel, chases::suspend{});
}
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void protocol_block_in_31800::do_report(count_t sequence) NOEXCEPT
BC_ASSERT(stranded());

// Uses application logging since it outputs to a runtime option.
LOGA("Work report [" << sequence << "] is (" << map_->size() << ") for ["
LOGN("Work report [" << sequence << "] is (" << map_->size() << ") for ["
<< opposite() << "].");
}

Expand Down
14 changes: 7 additions & 7 deletions src/protocols/protocol_block_out_106.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ bool protocol_block_out_106::handle_receive_get_blocks(const code& ec,
if (stopped(ec))
return false;

LOGP("Get blocks above " << encode_hash(message->start_hash())
<< " from [" << opposite() << "].");
LOGP("Get blocks above [" << encode_hash(message->start_hash())
<< "] from [" << opposite() << "].");

SEND(create_inventory(*message), handle_send, _1);
return true;
Expand Down Expand Up @@ -218,7 +218,7 @@ void protocol_block_out_106::send_block(const code& ec, size_t index,

if (!out.block.is_valid())
{
LOGV("Requested block " << encode_hash(item.hash) << " from ["
LOGV("Requested block [" << encode_hash(item.hash) << "] from ["
<< opposite() << "] not obtained.");

if (handle_unservable(item))
Expand All @@ -240,7 +240,7 @@ bool protocol_block_out_106::is_servable(const hash_digest& LOG_ONLY(hash),
// A hash that resolves to no header is ordinary peer input.
if (link.is_terminal())
{
LOGV("Requested block " << encode_hash(hash) << " from ["
LOGV("Requested block [" << encode_hash(hash) << "] from ["
<< opposite() << "] not stored.");
return false;
}
Expand All @@ -249,14 +249,14 @@ bool protocol_block_out_106::is_servable(const hash_digest& LOG_ONLY(hash),
// This block could not have been advertised to the peer.
if (!query.is_associated(link))
{
LOGV("Requested block " << encode_hash(hash) << " from ["
LOGV("Requested block [" << encode_hash(hash) << "] from ["
<< opposite() << "] not found.");
return false;
}

if (query.is_pruned(link))
{
LOGV("Requested block " << encode_hash(hash) << " from ["
LOGV("Requested block [" << encode_hash(hash) << "] from ["
<< opposite() << "] pruned.");
return false;
}
Expand All @@ -270,7 +270,7 @@ bool protocol_block_out_106::handle_unservable(
{
BC_ASSERT(stranded());

LOGR("Unservable block " << encode_hash(item.hash) << " from ["
LOGR("Unservable block [" << encode_hash(item.hash) << "] from ["
<< opposite() << "], stopping.");

stop(system::error::not_found);
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/protocol_block_out_70014.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool protocol_block_out_70014::handle_receive_get_data(const code& ec,
const auto block = make_compact_block(link);
if (!block)
{
LOGF("Compact block " << encode_hash(item.hash) << " not made.");
LOGF("Compact block [" << encode_hash(item.hash) << "] not made.");
continue;
}

Expand Down
Loading
Loading