Increase JLOG usage.

This commit is contained in:
Scott Schurr
2016-02-19 16:05:30 -08:00
committed by Vinnie Falco
parent 0703441ee7
commit 9cb02028ed
19 changed files with 377 additions and 371 deletions

View File

@@ -96,8 +96,9 @@ PeerImp::PeerImp (Application& app, id_t id, endpoint_type remote_endpoint,
PeerImp::~PeerImp ()
{
if (cluster())
if (journal_.warning) journal_.warning <<
name_ << " left cluster";
{
JLOG(journal_.warning) << name_ << " left cluster";
}
if (state_ == State::active)
overlay_.onPeerDeactivate(id_);
overlay_.peerFinder().on_closed (slot_);
@@ -171,13 +172,11 @@ PeerImp::stop()
//
if(m_inbound)
{
if(journal_.debug) journal_.debug <<
"Stop";
JLOG(journal_.debug) << "Stop";
}
else
{
if(journal_.info) journal_.info <<
"Stop";
JLOG(journal_.info) << "Stop";
}
}
close();
@@ -351,7 +350,7 @@ PeerImp::json()
default:
// FIXME: do we really want this?
p_journal_.warning <<
JLOG(p_journal_.warning) <<
"Unknown status: " << last_status_.newstatus ();
}
}
@@ -423,13 +422,11 @@ PeerImp::close()
socket_.close(ec);
if(m_inbound)
{
if(journal_.debug) journal_.debug <<
"Closed";
JLOG(journal_.debug) << "Closed";
}
else
{
if(journal_.info) journal_.info <<
"Closed";
JLOG(journal_.info) << "Closed";
}
}
}
@@ -442,8 +439,9 @@ PeerImp::fail(std::string const& reason)
(void(Peer::*)(std::string const&))&PeerImp::fail,
shared_from_this(), reason));
if (socket_.is_open())
if (journal_.debug) journal_.debug <<
reason;
{
JLOG (journal_.debug) << reason;
}
close();
}
@@ -452,8 +450,9 @@ PeerImp::fail(std::string const& name, error_code ec)
{
assert(strand_.running_in_this_thread());
if (socket_.is_open())
if (journal_.debug) journal_.debug <<
name << ": " << ec.message();
{
JLOG(journal_.debug) << name << ": " << ec.message();
}
close();
}
@@ -485,8 +484,7 @@ PeerImp::setTimer()
if (ec)
{
if (journal_.error) journal_.error <<
"setTimer: " << ec.message();
JLOG(journal_.error) << "setTimer: " << ec.message();
return;
}
timer_.async_wait(strand_.wrap(std::bind(&PeerImp::onTimer,
@@ -523,8 +521,7 @@ PeerImp::onTimer (error_code const& ec)
if (ec)
{
// This should never happen
if (journal_.error) journal_.error <<
"onTimer: " << ec.message();
JLOG(journal_.error) << "onTimer: " << ec.message();
return close();
}
@@ -576,8 +573,7 @@ PeerImp::onShutdown(error_code ec)
// If we don't get eof then something went wrong
if (! ec)
{
if (journal_.error) journal_.error <<
"onShutdown: expected error condition";
JLOG(journal_.error) << "onShutdown: expected error condition";
return close();
}
if (ec != boost::asio::error::eof)
@@ -592,8 +588,7 @@ void PeerImp::doAccept()
assert(read_buffer_.size() == 0);
assert(http_message_.upgrade());
if(journal_.debug) journal_.debug <<
"doAccept: " << remote_address_;
JLOG(journal_.debug) << "doAccept: " << remote_address_;
auto sharedValue = makeSharedValue(
ssl_bundle_->stream.native_handle(), journal_);
@@ -610,17 +605,15 @@ void PeerImp::doAccept()
beast::http::write (write_buffer_, resp);
auto const protocol = BuildInfo::make_protocol(hello_.protoversion());
if(journal_.info) journal_.info <<
"Protocol: " << to_string(protocol);
if(journal_.info) journal_.info <<
JLOG(journal_.info) << "Protocol: " << to_string(protocol);
JLOG(journal_.info) <<
"Public Key: " << toBase58 (
TokenType::TOKEN_NODE_PUBLIC,
publicKey_);
if (auto member = app_.cluster().member(publicKey_))
{
name_ = *member;
if (journal_.info) journal_.info <<
"Cluster name: " << name_;
JLOG(journal_.info) << "Cluster name: " << name_;
}
overlay_.activate(shared_from_this());
@@ -682,10 +675,11 @@ PeerImp::onWriteResponse (error_code ec, std::size_t bytes_transferred)
return fail("onWriteResponse", ec);
if(journal_.trace)
{
if (bytes_transferred > 0) journal_.trace <<
"onWriteResponse: " << bytes_transferred << " bytes";
else journal_.trace <<
"onWriteResponse";
if (bytes_transferred > 0)
journal_.trace <<
"onWriteResponse: " << bytes_transferred << " bytes";
else
journal_.trace << "onWriteResponse";
}
write_buffer_.consume (bytes_transferred);
@@ -736,18 +730,18 @@ PeerImp::onReadMessage (error_code ec, std::size_t bytes_transferred)
return;
if(ec == boost::asio::error::eof)
{
if(journal_.info) journal_.info <<
"EOF";
JLOG(journal_.info) << "EOF";
return gracefulClose();
}
if(ec)
return fail("onReadMessage", ec);
if(journal_.trace)
{
if (bytes_transferred > 0) journal_.trace <<
"onReadMessage: " << bytes_transferred << " bytes";
else journal_.trace <<
"onReadMessage";
if (bytes_transferred > 0)
journal_.trace <<
"onReadMessage: " << bytes_transferred << " bytes";
else
journal_.trace << "onReadMessage";
}
read_buffer_.commit (bytes_transferred);
@@ -785,10 +779,11 @@ PeerImp::onWriteMessage (error_code ec, std::size_t bytes_transferred)
return fail("onWriteMessage", ec);
if(journal_.trace)
{
if (bytes_transferred > 0) journal_.trace <<
"onWriteMessage: " << bytes_transferred << " bytes";
else journal_.trace <<
"onWriteMessage";
if (bytes_transferred > 0)
journal_.trace <<
"onWriteMessage: " << bytes_transferred << " bytes";
else
journal_.trace << "onWriteMessage";
}
assert(! send_queue_.empty());
@@ -1095,8 +1090,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
return;
}
p_journal_.debug <<
"Got tx " << txID;
JLOG(p_journal_.debug) << "Got tx " << txID;
bool checkSignature = true;
if (cluster())
@@ -1117,9 +1111,13 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
}
if (app_.getJobQueue().getJobCount(jtTRANSACTION) > 100)
p_journal_.info << "Transaction queue is full";
{
JLOG(p_journal_.info) << "Transaction queue is full";
}
else if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)
p_journal_.trace << "No new transactions until synchronized";
{
JLOG(p_journal_.trace) << "No new transactions until synchronized";
}
else
{
app_.getJobQueue ().addJob (
@@ -1134,7 +1132,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
}
catch (std::exception const&)
{
p_journal_.warning << "Transaction invalid: " <<
JLOG(p_journal_.warning) << "Transaction invalid: " <<
strHex(m->rawtransaction ());
}
}
@@ -1159,7 +1157,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (m->nodes ().size () <= 0)
{
p_journal_.warning << "Ledger/TXset data with no nodes";
JLOG(p_journal_.warning) << "Ledger/TXset data with no nodes";
return;
}
@@ -1174,7 +1172,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
}
else
{
p_journal_.info << "Unable to route TX/ledger data reply";
JLOG(p_journal_.info) << "Unable to route TX/ledger data reply";
fee_ = Resource::feeUnwantedData;
}
return;
@@ -1184,7 +1182,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (m->ledgerhash ().size () != 32)
{
p_journal_.warning << "TX candidate reply with invalid hash size";
JLOG(p_journal_.warning) << "TX candidate reply with invalid hash size";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1208,7 +1206,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMLedgerData> const& m)
if (!app_.getInboundLedgers ().gotLedgerData (
hash, shared_from_this(), m))
{
p_journal_.trace << "Got data for unwanted ledger";
JLOG(p_journal_.trace) << "Got data for unwanted ledger";
fee_ = Resource::feeUnwantedData;
}
}
@@ -1236,14 +1234,14 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
(set.signature ().size () > 128)
)
{
p_journal_.warning << "Proposal: malformed";
JLOG(p_journal_.warning) << "Proposal: malformed";
fee_ = Resource::feeInvalidSignature;
return;
}
if (set.previousledger ().size () != 32)
{
p_journal_.warning << "Proposal: malformed";
JLOG(p_journal_.warning) << "Proposal: malformed";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1262,14 +1260,14 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
if (! app_.getHashRouter ().addSuppressionPeer (suppression, id_))
{
p_journal_.trace << "Proposal: duplicate";
JLOG(p_journal_.trace) << "Proposal: duplicate";
return;
}
if (app_.config().VALIDATION_PUB.size() &&
publicKey == app_.config().VALIDATION_PUB)
{
p_journal_.trace << "Proposal: self";
JLOG(p_journal_.trace) << "Proposal: self";
return;
}
@@ -1279,18 +1277,18 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
{
if (sanity_.load() == Sanity::insane)
{
p_journal_.debug << "Proposal: Dropping UNTRUSTED (insane)";
JLOG(p_journal_.debug) << "Proposal: Dropping UNTRUSTED (insane)";
return;
}
if (app_.getFeeTrack ().isLoadedLocal ())
{
p_journal_.debug << "Proposal: Dropping UNTRUSTED (load)";
JLOG(p_journal_.debug) << "Proposal: Dropping UNTRUSTED (load)";
return;
}
}
p_journal_.trace <<
JLOG(p_journal_.trace) <<
"Proposal: " << (isTrusted ? "trusted" : "UNTRUSTED");
auto proposal = std::make_shared<LedgerProposal> (
@@ -1310,7 +1308,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
void
PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
{
p_journal_.trace << "Status: Change";
JLOG(p_journal_.trace) << "Status: Change";
if (!m->has_networktime ())
m->set_networktime (app_.timeKeeper().now().time_since_epoch().count());
@@ -1329,7 +1327,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
{
if (!closedLedgerHash_.isZero ())
{
p_journal_.trace << "Status: Out of sync";
JLOG(p_journal_.trace) << "Status: Out of sync";
closedLedgerHash_.zero ();
}
@@ -1342,11 +1340,11 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)
// a peer has changed ledgers
memcpy (closedLedgerHash_.begin (), m->ledgerhash ().data (), 256 / 8);
addLedger (closedLedgerHash_);
p_journal_.trace << "LCL is " << closedLedgerHash_;
JLOG(p_journal_.trace) << "LCL is " << closedLedgerHash_;
}
else
{
p_journal_.trace << "Status: No ledger";
JLOG(p_journal_.trace) << "Status: No ledger";
closedLedgerHash_.zero ();
}
@@ -1571,7 +1569,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (m->validation ().size () < 50)
{
p_journal_.warning << "Validation: Too small";
JLOG(p_journal_.warning) << "Validation: Too small";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1588,7 +1586,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (! app_.getValidations().current (val))
{
p_journal_.trace << "Validation: Not current";
JLOG(p_journal_.trace) << "Validation: Not current";
fee_ = Resource::feeUnwantedData;
return;
}
@@ -1596,7 +1594,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (! app_.getHashRouter ().addSuppressionPeer(
sha512Half(makeSlice(m->validation())), id_))
{
p_journal_.trace << "Validation: duplicate";
JLOG(p_journal_.trace) << "Validation: duplicate";
return;
}
@@ -1605,7 +1603,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
if (!isTrusted && (sanity_.load () == Sanity::insane))
{
p_journal_.debug <<
JLOG(p_journal_.debug) <<
"Validation: dropping untrusted from insane peer";
}
if (isTrusted || !app_.getFeeTrack ().isLoadedLocal ())
@@ -1625,13 +1623,13 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMValidation> const& m)
}
else
{
p_journal_.debug <<
JLOG(p_journal_.debug) <<
"Validation: Dropping UNTRUSTED (load)";
}
}
catch (std::exception const& e)
{
p_journal_.warning <<
JLOG(p_journal_.warning) <<
"Validation: Exception, " << e.what();
fee_ = Resource::feeInvalidRequest;
}
@@ -1647,8 +1645,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
// this is a query
if (send_queue_.size() >= Tuning::dropSendQueue)
{
if (p_journal_.debug) p_journal_.debug <<
"GetObject: Large send queue";
JLOG(p_journal_.debug) << "GetObject: Large send queue";
return;
}
@@ -1702,7 +1699,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
}
}
p_journal_.trace <<
JLOG(p_journal_.trace) <<
"GetObj: " << reply.objects_size () <<
" of " << packet.objects_size ();
send (std::make_shared<Message> (reply, protocol::mtGET_OBJECTS));
@@ -1724,17 +1721,19 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
{
if (obj.ledgerseq () != pLSeq)
{
if ((pLDo && (pLSeq != 0)) &&
p_journal_.active(beast::Journal::Severity::kDebug))
p_journal_.debug <<
if (pLDo && (pLSeq != 0))
{
JLOG(p_journal_.debug) <<
"GetObj: Full fetch pack for " << pLSeq;
}
pLSeq = obj.ledgerseq ();
pLDo = !app_.getLedgerMaster ().haveLedger (pLSeq);
if (!pLDo)
p_journal_.debug <<
"GetObj: Late fetch pack for " << pLSeq;
{
JLOG(p_journal_.debug) <<
"GetObj: Late fetch pack for " << pLSeq;
}
else
progress = true;
}
@@ -1754,10 +1753,11 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMGetObjectByHash> const& m)
}
}
if ((pLDo && (pLSeq != 0)) &&
p_journal_.active(beast::Journal::Severity::kDebug))
p_journal_.debug << "GetObj: Partial fetch pack for " << pLSeq;
if (pLDo && (pLSeq != 0))
{
JLOG(p_journal_.debug) <<
"GetObj: Partial fetch pack for " << pLSeq;
}
if (packet.type () == protocol::TMGetObjectByHash::otFETCH_PACK)
app_.getLedgerMaster ().gotFetchPack (progress, pLSeq);
}
@@ -1806,13 +1806,13 @@ PeerImp::doFetchPack (const std::shared_ptr<protocol::TMGetObjectByHash>& packet
(app_.getLedgerMaster().getValidatedLedgerAge() > 40s) ||
(app_.getJobQueue().getJobCount(jtPACK) > 10))
{
p_journal_.info << "Too busy to make fetch pack";
JLOG(p_journal_.info) << "Too busy to make fetch pack";
return;
}
if (packet->ledgerhash ().size () != 32)
{
p_journal_.warning << "FetchPack hash size malformed";
JLOG(p_journal_.warning) << "FetchPack hash size malformed";
fee_ = Resource::feeInvalidRequest;
return;
}
@@ -1884,8 +1884,10 @@ PeerImp::checkTransaction (int flags,
if (tx->getStatus () == INVALID)
{
if (! reason.empty ())
p_journal_.trace << "Exception checking transaction: " << reason;
{
JLOG(p_journal_.trace) <<
"Exception checking transaction: " << reason;
}
app_.getHashRouter ().setFlags (stx->getTransactionID (), SF_BAD);
charge (Resource::feeInvalidSignature);
return;
@@ -1910,7 +1912,7 @@ PeerImp::checkPropose (Job& job,
{
bool isTrusted = (job.getType () == jtPROPOSAL_t);
p_journal_.trace <<
JLOG(p_journal_.trace) <<
"Checking " << (isTrusted ? "trusted" : "UNTRUSTED") << " proposal";
assert (packet);
@@ -1918,7 +1920,7 @@ PeerImp::checkPropose (Job& job,
if (! cluster() && ! proposal->checkSign ())
{
p_journal_.warning <<
JLOG(p_journal_.warning) <<
"Proposal fails sig check";
charge (Resource::feeInvalidSignature);
return;
@@ -1934,13 +1936,13 @@ PeerImp::checkPropose (Job& job,
if (app_.getOPs().getConsensusLCL() == proposal->getPrevLedger())
{
// relay untrusted proposal
p_journal_.trace <<
JLOG(p_journal_.trace) <<
"relaying UNTRUSTED proposal";
overlay_.relay(set, proposal->getSuppressionID());
}
else
{
p_journal_.debug <<
JLOG(p_journal_.debug) <<
"Not relaying UNTRUSTED proposal";
}
}
@@ -1956,7 +1958,7 @@ PeerImp::checkValidation (STValidation::pointer val,
uint256 signingHash = val->getSigningHash();
if (! cluster() && !val->isValid (signingHash))
{
p_journal_.warning <<
JLOG(p_journal_.warning) <<
"Validation is invalid";
charge (Resource::feeInvalidRequest);
return;
@@ -1968,7 +1970,7 @@ PeerImp::checkValidation (STValidation::pointer val,
}
catch (std::exception const&)
{
p_journal_.trace <<
JLOG(p_journal_.trace) <<
"Exception processing validation";
charge (Resource::feeInvalidRequest);
}
@@ -2048,14 +2050,12 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.itype () == protocol::liTS_CANDIDATE)
{
// Request is for a transaction candidate set
if (p_journal_.trace) p_journal_.trace <<
"GetLedger: Tx candidate set";
JLOG(p_journal_.trace) << "GetLedger: Tx candidate set";
if ((!packet.has_ledgerhash () || packet.ledgerhash ().size () != 32))
{
charge (Resource::feeInvalidRequest);
if (p_journal_.warning) p_journal_.warning <<
"GetLedger: Tx candidate set invalid";
JLOG(p_journal_.warning) << "GetLedger: Tx candidate set invalid";
return;
}
@@ -2069,15 +2069,13 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
{
if (packet.has_querytype () && !packet.has_requestcookie ())
{
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Routing Tx set request";
JLOG(p_journal_.debug) << "GetLedger: Routing Tx set request";
auto const v = getPeerWithTree(
overlay_, txHash, this);
if (! v)
{
if (p_journal_.info) p_journal_.info <<
"GetLedger: Route TX set failed";
JLOG(p_journal_.info) << "GetLedger: Route TX set failed";
return;
}
@@ -2087,8 +2085,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
return;
}
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Can't provide map ";
JLOG(p_journal_.debug) << "GetLedger: Can't provide map ";
charge (Resource::feeInvalidRequest);
return;
}
@@ -2102,21 +2099,18 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
{
if (send_queue_.size() >= Tuning::dropSendQueue)
{
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Large send queue";
JLOG(p_journal_.debug) << "GetLedger: Large send queue";
return;
}
if (app_.getFeeTrack().isLoadedLocal() && ! cluster())
{
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Too busy";
JLOG(p_journal_.debug) << "GetLedger: Too busy";
return;
}
// Figure out what ledger they want
if (p_journal_.trace) p_journal_.trace <<
"GetLedger: Received";
JLOG(p_journal_.trace) << "GetLedger: Received";
Ledger::pointer ledger;
if (packet.has_ledgerhash ())
@@ -2126,8 +2120,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.ledgerhash ().size () != 32)
{
charge (Resource::feeInvalidRequest);
if (p_journal_.warning) p_journal_.warning <<
"GetLedger: Invalid request";
JLOG(p_journal_.warning) << "GetLedger: Invalid request";
return;
}
@@ -2137,9 +2130,10 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
ledger = app_.getLedgerMaster ().getLedgerByHash (ledgerhash);
if (!ledger)
if (p_journal_.trace) p_journal_.trace <<
{
JLOG(p_journal_.trace) <<
"GetLedger: Don't have " << ledgerhash;
}
if (!ledger && (packet.has_querytype () &&
!packet.has_requestcookie ()))
{
@@ -2152,16 +2146,14 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
overlay_, ledgerhash, seq, this);
if (! v)
{
if (p_journal_.trace) p_journal_.trace <<
"GetLedger: Cannot route";
JLOG(p_journal_.trace) << "GetLedger: Cannot route";
return;
}
packet.set_requestcookie (id ());
v->send (std::make_shared<Message>(
packet, protocol::mtGET_LEDGER));
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Request routed";
JLOG(p_journal_.debug) << "GetLedger: Request routed";
return;
}
}
@@ -2170,15 +2162,16 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.ledgerseq() <
app_.getLedgerMaster().getEarliestFetch())
{
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Early ledger request";
JLOG(p_journal_.debug) << "GetLedger: Early ledger request";
return;
}
ledger = app_.getLedgerMaster ().getLedgerBySeq (
packet.ledgerseq ());
if (! ledger)
if (p_journal_.debug) p_journal_.debug <<
{
JLOG(p_journal_.debug) <<
"GetLedger: Don't have " << packet.ledgerseq ();
}
}
else if (packet.has_ltype () && (packet.ltype () == protocol::ltCLOSED) )
{
@@ -2191,8 +2184,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
else
{
charge (Resource::feeInvalidRequest);
if (p_journal_.warning) p_journal_.warning <<
"GetLedger: Unknown request";
JLOG(p_journal_.warning) << "GetLedger: Unknown request";
return;
}
@@ -2202,17 +2194,16 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
charge (Resource::feeInvalidRequest);
if (ledger)
if (p_journal_.warning) p_journal_.warning <<
"GetLedger: Invalid sequence";
{
JLOG(p_journal_.warning) << "GetLedger: Invalid sequence";
}
return;
}
if (!packet.has_ledgerseq() && (ledger->info().seq <
app_.getLedgerMaster().getEarliestFetch()))
{
if (p_journal_.debug) p_journal_.debug <<
"GetLedger: Early ledger request";
JLOG(p_journal_.debug) << "GetLedger: Early ledger request";
return;
}
@@ -2225,8 +2216,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (packet.itype () == protocol::liBASE)
{
// they want the ledger base data
if (p_journal_.trace) p_journal_.trace <<
"GetLedger: Base data";
JLOG(p_journal_.trace) << "GetLedger: Base data";
Serializer nData (128);
ledger->addRaw (nData);
reply.add_nodes ()->set_nodedata (
@@ -2281,14 +2271,13 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!map || (packet.nodeids_size () == 0))
{
if (p_journal_.warning) p_journal_.warning <<
JLOG(p_journal_.warning) <<
"GetLedger: Can't find map or empty request";
charge (Resource::feeInvalidRequest);
return;
}
if (p_journal_.trace) p_journal_.trace <<
"GetLeder: " << logMe;
JLOG(p_journal_.trace) << "GetLedger: " << logMe;
auto const depth =
packet.has_querydepth() ?
@@ -2303,8 +2292,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!mn.isValid ())
{
if (p_journal_.warning) p_journal_.warning <<
"GetLedger: Invalid node " << logMe;
JLOG(p_journal_.warning) << "GetLedger: Invalid node " << logMe;
charge (Resource::feeInvalidRequest);
return;
}
@@ -2319,7 +2307,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (map && map->getNodeFat (mn, nodeIDs, rawNodes, fatLeaves, depth))
{
assert (nodeIDs.size () == rawNodes.size ());
if (p_journal_.trace) p_journal_.trace <<
JLOG(p_journal_.trace) <<
"GetLedger: getNodeFat got " << rawNodes.size () << " nodes";
std::vector<SHAMapNodeID>::iterator nodeIDIterator;
std::vector< Blob >::iterator rawNodeIterator;
@@ -2338,7 +2326,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
}
}
else
p_journal_.warning <<
JLOG(p_journal_.warning) <<
"GetLedger: getNodeFat returns false";
}
catch (std::exception&)
@@ -2357,12 +2345,12 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
if (!packet.has_ledgerhash ())
info += ", no hash specified";
if (p_journal_.warning) p_journal_.warning <<
JLOG(p_journal_.warning) <<
"getNodeFat( " << mn << ") throws exception: " << info;
}
}
if (p_journal_.info) p_journal_.info <<
JLOG(p_journal_.info) <<
"Got request for " << packet.nodeids().size() << " nodes at depth " <<
depth << ", return " << reply.nodes().size() << " nodes";