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
22 changes: 11 additions & 11 deletions src/protocols/protocol_block_in_106.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ bool protocol_block_in_106::handle_receive_inventory(const code& ec,
if (!tracker_.ids.empty())
{
LOGP("Unrequested (" << block_count << ") block inventory from ["
<< authority() << "] with (" << tracker_.ids.size()
<< opposite() << "] with (" << tracker_.ids.size()
<< ") pending.");
return true;
}

const auto getter = create_get_data(*message);
LOGP("Received (" << block_count << ") block inventory from ["
<< authority() << "] with (" << getter.items.size()
<< opposite() << "] with (" << getter.items.size()
<< ") new blocks.");

// If getter is empty it may be because we have them all.
Expand All @@ -103,12 +103,12 @@ bool protocol_block_in_106::handle_receive_inventory(const code& ec,

// A non-maximal inventory has no new blocks, assume complete.
// Inventory completeness assumes empty response if caught up at 500.
LOGP("Completed block inventory from [" << authority() << "].");
LOGP("Completed block inventory from [" << opposite() << "].");
return true;
}

LOGP("Requested (" << getter.items.size() << ") blocks from ["
<< authority() << "].");
<< opposite() << "].");

// Track inventory and request blocks (to_hashes order is reversed).
tracker_.announced = block_count;
Expand Down Expand Up @@ -136,7 +136,7 @@ bool protocol_block_in_106::handle_receive_block(const code& ec,
if (tracker_.ids.find(block_ptr->get_hash()) == tracker_.ids.end())
{
LOGP("Unrequested block [" << encode_hash(block_ptr->get_hash())
<< "] from [" << authority() << "].");
<< "] from [" << opposite() << "].");
return true;
}

Expand Down Expand Up @@ -176,20 +176,20 @@ void protocol_block_in_106::do_handle_organize(const code& ec, size_t height,
// Many peers blindly broadcast blocks even at/above v31800, ugh.
// If we are not caught up on headers this is useless information.
LOGP("Block [" << encode_hash(block_ptr->get_hash()) << "] from ["
<< authority() << "] " << ec.message());
<< opposite() << "] " << ec.message());
}
else
{
LOGR("Block [" << encode_hash(block_ptr->hash()) << ":" << height
<< "] from [" << authority() << "] " << ec.message());
<< "] from [" << opposite() << "] " << ec.message());
}

stop(ec);
return;
}

LOGP("Block [" << encode_hash(block_ptr->get_hash()) << ":" << height
<< "] from [" << authority() << "].");
<< "] from [" << opposite() << "].");

// Completion of tracked inventory.
if (tracker_.ids.empty())
Expand All @@ -203,7 +203,7 @@ void protocol_block_in_106::do_handle_organize(const code& ec, size_t height,
{
// Completeness stalls if on 500 as empty message is ambiguous.
// This is ok, since complete is not used for anything essential.
LOGP("Completed blocks from [" << authority() << "] with ("
LOGP("Completed blocks from [" << opposite() << "] with ("
<< tracker_.announced << ") announced.");
}
}
Expand Down Expand Up @@ -238,13 +238,13 @@ get_blocks protocol_block_in_106::create_get_inventory(
if (hashes.size() == one)
{
LOGP("Request block inventory after [" << encode_hash(hashes.front())
<< "] from [" << authority() << "].");
<< "] from [" << opposite() << "].");
}
else
{
LOGP("Request block inventory (" << hashes.size() << ") after ["
<< encode_hash(hashes.front()) << "] from ["
<< authority() << "].");
<< opposite() << "].");
}

return { std::move(hashes) };
Expand Down
24 changes: 12 additions & 12 deletions src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void protocol_block_in_31800::do_purge(peer_t) NOEXCEPT

if (!map_->empty())
{
LOGV("Purge work (" << map_->size() << ") from [" << authority() << "].");
LOGV("Purge work (" << map_->size() << ") from [" << opposite() << "].");
map_->clear();
stop(error::sacrificed_channel);
}
Expand All @@ -196,7 +196,7 @@ void protocol_block_in_31800::do_split(peer_t) NOEXCEPT
if (stopped())
return;

LOGV("Divide work (" << map_->size() << ") from [" << authority() << "].");
LOGV("Divide work (" << map_->size() << ") from [" << opposite() << "].");
restore(chaser_check::split(map_));
restore(map_);
map_ = chaser_check::empty_map();
Expand All @@ -209,7 +209,7 @@ void protocol_block_in_31800::do_report(count_t sequence) NOEXCEPT

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

// request hashes
Expand Down Expand Up @@ -279,7 +279,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
{
// Allow unrequested block, not counted toward performance.
LOGR("Unrequested block [" << encode_hash(hash) << "] from ["
<< authority() << "].");
<< opposite() << "].");
return true;
}

Expand All @@ -302,7 +302,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
code == system::error::invalid_witness_commitment)
{
LOGR("Malleated block [" << encode_hash(hash) << ":" << height
<< "] from [" << authority() << "] " << code.message()
<< "] from [" << opposite() << "] " << code.message()
<< " txs(" << block->transactions() << ")"
<< " segregated(" << block->is_segregated() << ").");
stop(code);
Expand All @@ -316,7 +316,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
}

LOGR("Block failed check [" << encode_hash(hash) << ":" << height
<< "] from [" << authority() << "] " << code.message());
<< "] from [" << opposite() << "] " << code.message());
notify(error::success, chase::unchecked, link);
fire(events::block_unconfirmable, height);
stop(code);
Expand All @@ -329,7 +329,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
if (const auto code = query.set_code(*block, link, checked))
{
LOGF("Failure storing block [" << encode_hash(hash) << ":" << height
<< "] from [" << authority() << "] " << code.message());
<< "] from [" << opposite() << "] " << code.message());

stop(fault(code));
return false;
Expand All @@ -339,7 +339,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
// ........................................................................

LOGP("Downloaded block [" << encode_hash(hash) << ":" << height
<< "] from [" << authority() << "].");
<< "] from [" << opposite() << "].");

notify(ec, chase::checked, height);
fire(events::block_archived, height);
Expand Down Expand Up @@ -388,18 +388,18 @@ void protocol_block_in_31800::restore(const map_ptr& map) NOEXCEPT
void protocol_block_in_31800::handle_put_hashes(const code& ec,
size_t count) NOEXCEPT
{
LOGV("Put (" << count << ") work for [" << authority() << "].");
LOGV("Put (" << count << ") work for [" << opposite() << "].");

if (ec)
{
LOGF("Error putting work for [" << authority() << "] " << ec.message());
LOGF("Error putting work for [" << opposite() << "] " << ec.message());
}
}

void protocol_block_in_31800::handle_get_hashes(const code& ec,
const map_ptr& map, const job::ptr& job) NOEXCEPT
{
LOGV("Got (" << map->size() << ") work for [" << authority() << "].");
LOGV("Got (" << map->size() << ") work for [" << opposite() << "].");

if (stopped())
{
Expand All @@ -409,7 +409,7 @@ void protocol_block_in_31800::handle_get_hashes(const code& ec,

if (ec)
{
LOGF("Error getting work for [" << authority() << "] " << ec.message());
LOGF("Error getting work for [" << opposite() << "] " << ec.message());
stop(ec);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/protocol_block_out_106.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool protocol_block_out_106::handle_receive_get_blocks(const code& ec,
return false;

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

SEND(create_inventory(*message), handle_send, _1);
return true;
Expand Down Expand Up @@ -178,7 +178,7 @@ void protocol_block_out_106::send_block(const code& ec, size_t index,
const auto witness = item.is_witness_type();
if (!node_witness_ && witness)
{
LOGR("Unsupported witness get_data from [" << authority() << "].");
LOGR("Unsupported witness get_data from [" << opposite() << "].");
stop(network::error::protocol_violation);
return;
}
Expand All @@ -192,7 +192,7 @@ void protocol_block_out_106::send_block(const code& ec, size_t index,
if (!ptr)
{
LOGR("Requested block " << encode_hash(item.hash)
<< " from [" << authority() << "] not found.");
<< " from [" << opposite() << "] not found.");

// This block could not have been advertised to the peer.
stop(system::error::not_found);
Expand Down
20 changes: 10 additions & 10 deletions src/protocols/protocol_header_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool protocol_header_in_31800::handle_receive_headers(const code& ec,
return false;

LOGP("Headers (" << message->header_ptrs.size() << ") from ["
<< authority() << "].");
<< opposite() << "].");

// Store each header, drop channel if invalid.
for (const auto& ptr: message->header_ptrs)
Expand All @@ -89,7 +89,7 @@ bool protocol_header_in_31800::handle_receive_headers(const code& ec,
{
// Protocol presumes max_get_headers unless complete.
// Completeness assumes empty response from peer if caught up at 2000.
LOGP("Completed headers from [" << authority() << "].");
LOGP("Completed headers from [" << opposite() << "].");
complete();
}

Expand All @@ -111,20 +111,20 @@ void protocol_header_in_31800::handle_organize(const code& ec,
if (is_zero(height))
{
LOGP("Header [" << encode_hash(header_ptr->get_hash()) << "] from ["
<< authority() << "] " << ec.message());
<< opposite() << "] " << ec.message());
}
else
{
LOGR("Header [" << encode_hash(header_ptr->get_hash()) << ":"
<< height << "] from [" << authority() << "] " << ec.message());
<< height << "] from [" << opposite() << "] " << ec.message());
}

stop(ec);
return;
}

LOGP("Header [" << encode_hash(header_ptr->get_hash()) << ":" << height
<< "] from [" << authority() << "] " << ec.message());
<< "] from [" << opposite() << "] " << ec.message());
}

// This could be the end of a catch-up sequence, or a singleton announcement.
Expand All @@ -138,7 +138,7 @@ void protocol_header_in_31800::complete() NOEXCEPT
{
subscribed = true;
SUBSCRIBE_CHANNEL(inventory, handle_receive_inventory, _1, _2);
LOGP("Subscribed to block announcements at [" << authority() << "].");
LOGP("Subscribed to block announcements at [" << opposite() << "].");
}
}

Expand Down Expand Up @@ -199,13 +199,13 @@ get_headers protocol_header_in_31800::create_get_headers(
if (is_one(hashes.size()))
{
LOGP("Request headers after [" << encode_hash(hashes.front())
<< "] from [" << authority() << "].");
<< "] from [" << opposite() << "].");
}
else
{
LOGP("Request headers (" << hashes.size() << ") after ["
<< encode_hash(hashes.front()) << "] from ["
<< authority() << "].");
LOGP("Request headers (" << hashes.size()
<< ") after [" << encode_hash(hashes.front())
<< "] from [" << opposite() << "].");
}

return { std::move(hashes) };
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/protocol_header_in_70012.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void protocol_header_in_70012::complete() NOEXCEPT
{
subscribed = true;
SEND(send_headers{}, handle_send, _1);
LOGP("Subscribed to header announcements at [" << authority() << "].");
LOGP("Subscribed to header announcements at [" << opposite() << "].");
}

// Must come after subscribed is updated.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/protocol_header_out_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool protocol_header_out_31800::handle_receive_get_headers(const code& ec,
return false;

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

SEND(create_headers(*message), handle_send, _1);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_header_out_70012.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool protocol_header_out_70012::do_announce(header_t link) NOEXCEPT
if (was_announced(hash))
{
LOGP("Suppress " << encode_hash(hash) << " to ["
<< authority() << "].");
<< opposite() << "].");
return true;
}

Expand All @@ -112,7 +112,7 @@ bool protocol_header_out_70012::do_announce(header_t link) NOEXCEPT
return true;
}

LOGN("Announce " << encode_hash(hash) << " to [" << authority() << "].");
LOGN("Announce " << encode_hash(hash) << " to [" << opposite() << "].");
SEND(headers{ { ptr } }, handle_send, _1);
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/protocol_observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool protocol_observer::handle_receive_inventory(const code& ec,
// Common with Satoshi 25.0 and 25.1.
if (relay_disallowed_ && message->any_transaction())
{
LOGR("Unrequested tx relay from [" << authority() << "] "
LOGR("Unrequested tx relay from [" << opposite() << "] "
<< peer_version()->user_agent);

stop(network::error::protocol_violation);
Expand All @@ -119,7 +119,7 @@ bool protocol_observer::handle_receive_inventory(const code& ec,
////// Witness types never allowed in inventory (wxtid excluded).
////if (message->any_witness())
////{
//// LOGR("Unsupported witness inventory from [" << authority() << "].");
//// LOGR("Unsupported witness inventory from [" << opposite() << "].");
//// stop(network::error::protocol_violation);
//// return false;
////}
Expand All @@ -138,7 +138,7 @@ bool protocol_observer::handle_receive_inventory(const code& ec,
//// // Witness types only allowed in get_data if witness service advertised.
//// if (!node_witness_ && message->any_witness())
//// {
//// LOGR("Unsupported witness get_data from [" << authority() << "].");
//// LOGR("Unsupported witness get_data from [" << authority42() << "].");
//// stop(network::error::protocol_violation);
//// return false;
//// }
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_performer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ void protocol_performer::do_handle_performance(const code& ec) NOEXCEPT
// Caused only by performance(zero|xxx) - had outstanding work.
if (ec == error::stalled_channel || ec == error::slow_channel)
{
LOGP("Channel dropped [" << authority() << "] " << ec.message());
LOGP("Channel dropped [" << opposite() << "] " << ec.message());
stop(ec);
return;
}

if (ec)
{
LOGF("Performance failure [" << authority() << "] " << ec.message());
LOGF("Performance failure [" << opposite() << "] " << ec.message());
stop(ec);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_transaction_out_106.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void protocol_transaction_out_106::send_transaction(const code& ec,
const auto witness = item.is_witness_type();
if (!node_witness_ && witness)
{
LOGR("Unsupported witness get_data from [" << authority() << "].");
LOGR("Unsupported witness get_data from [" << opposite() << "].");
stop(network::error::protocol_violation);
return;
}
Expand All @@ -176,7 +176,7 @@ void protocol_transaction_out_106::send_transaction(const code& ec,
if (!ptr)
{
LOGR("Requested tx " << encode_hash(item.hash)
<< " from [" << authority() << "] not found.");
<< " from [" << opposite() << "] not found.");

// This tx could not have been advertised to the peer.
stop(system::error::not_found);
Expand Down
Loading