Skip to content

Commit

Permalink
Refine block/header first logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Feb 24, 2024
1 parent ac0ebd8 commit dcc34be
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
16 changes: 8 additions & 8 deletions src/protocols/protocol_block_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,21 @@ void protocol_block_in::complete() NOEXCEPT
void protocol_block_in::handle_organize(const code& ec, size_t height,
const chain::block::cptr& block_ptr) NOEXCEPT
{
if (!ec)
if (ec == network::error::service_stopped)
return;

if (!ec || ec == error::duplicate_block)
{
LOGP("Block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
return;
}

// This may be either a remote error or store corruption.
if (ec != network::error::service_stopped)
{
LOGR("Error organizing block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
}
// Assuming no store failure this is a consensus failure.
LOGR("Block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());

stop(ec);
}
Expand Down
16 changes: 8 additions & 8 deletions src/protocols/protocol_block_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,21 @@ void protocol_block_in_31800::complete() NOEXCEPT
void protocol_block_in_31800::handle_organize(const code& ec, size_t height,
const chain::block::cptr& block_ptr) NOEXCEPT
{
if (!ec)
if (ec == network::error::service_stopped)
return;

if (!ec || ec == error::duplicate_block)
{
LOGP("Block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
return;
}

// This may be either a remote error or store corruption.
if (ec != network::error::service_stopped)
{
LOGR("Error organizing block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
}
// Assuming no store failure this is a consensus failure.
LOGR("Block [" << encode_hash(block_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());

stop(ec);
}
Expand Down
17 changes: 9 additions & 8 deletions src/protocols/protocol_header_in_31800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <bitcoin/database.hpp>
#include <bitcoin/network.hpp>
#include <bitcoin/node/define.hpp>
#include <bitcoin/node/error.hpp>

namespace libbitcoin {
namespace node {
Expand Down Expand Up @@ -123,21 +124,21 @@ void protocol_header_in_31800::complete() NOEXCEPT
void protocol_header_in_31800::handle_organize(const code& ec, size_t height,
const chain::header::cptr& header_ptr) NOEXCEPT
{
if (!ec)
if (ec == network::error::service_stopped)
return;

if (!ec || ec == error::duplicate_block)
{
LOGP("Header [" << encode_hash(header_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
return;
}

// This may be either a remote error or store corruption.
if (ec != network::error::service_stopped)
{
LOGR("Error organizing header [" << encode_hash(header_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());
}
// Assuming no store failure this is a consensus failure.
LOGR("Header [" << encode_hash(header_ptr->hash())
<< "] at (" << height << ") from [" << authority() << "] "
<< ec.message());

stop(ec);
}
Expand Down

0 comments on commit dcc34be

Please sign in to comment.