Skip to content

Commit

Permalink
removing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vlntb committed Jan 24, 2025
1 parent 16b8007 commit 7b63b8d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/xrpld/overlay/detail/PeerImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,12 +1039,12 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMManifests> const& m)

if (s == 0)
{
fee_.update(Resource::feeUselessData, " empty");
fee_.update(Resource::feeUselessData, "empty");
return;
}

if (s > 100)
fee_.update(Resource::feeModerateBurdenPeer, " oversize");
fee_.update(Resource::feeModerateBurdenPeer, "oversize");

app_.getJobQueue().addJob(
jtMANIFEST, "receiveManifests", [this, that = shared_from_this(), m]() {
Expand Down Expand Up @@ -1251,7 +1251,7 @@ PeerImp::handleTransaction(
// we have seen this transaction recently
if (flags & SF_BAD)
{
fee_.update(Resource::feeUselessData, " known bad");
fee_.update(Resource::feeUselessData, "known bad");
JLOG(p_journal_.debug()) << "Ignoring known bad tx " << txID;
}

Expand Down Expand Up @@ -1421,7 +1421,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProofPathRequest> const& m)
}

fee_.update(
Resource::feeModerateBurdenPeer, " received a proof path request");
Resource::feeModerateBurdenPeer, "received a proof path request");
std::weak_ptr<PeerImp> weak = shared_from_this();
app_.getJobQueue().addJob(
jtREPLAY_REQ, "recvProofPathRequest", [weak, m]() {
Expand Down Expand Up @@ -1473,7 +1473,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMReplayDeltaRequest> const& m)
return;
}

fee_.update(Resource::feeModerateBurdenPeer, " replay delta request");
fee_.update(Resource::feeModerateBurdenPeer, "replay delta request");
std::weak_ptr<PeerImp> weak = shared_from_this();
app_.getJobQueue().addJob(
jtREPLAY_REQ, "recvReplayDeltaRequest", [weak, m]() {
Expand Down Expand Up @@ -1520,7 +1520,7 @@ void
PeerImp::onMessage(std::shared_ptr<protocol::TMLedgerData> const& m)
{
auto badData = [&](std::string const& msg) {
fee_.update(Resource::feeInvalidData, " " + msg);
fee_.update(Resource::feeInvalidData, msg);
JLOG(p_journal_.warn()) << "TMLedgerData: " << msg;
};

Expand Down Expand Up @@ -1630,7 +1630,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
!stringIsUint256Sized(set.previousledger()))
{
JLOG(p_journal_.warn()) << "Proposal: malformed";
fee_.update(Resource::feeMalformedRequest, " bad hashes");
fee_.update(Resource::feeMalformedRequest, "bad hashes");
return;
}

Expand Down Expand Up @@ -1935,7 +1935,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMHaveTransactionSet> const& m)
{
if (!stringIsUint256Sized(m->hash()))
{
fee_.update(Resource::feeMalformedRequest, " bad hash");
fee_.update(Resource::feeMalformedRequest, "bad hash");
return;
}

Expand All @@ -1948,7 +1948,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMHaveTransactionSet> const& m)
if (std::find(recentTxSets_.begin(), recentTxSets_.end(), hash) !=
recentTxSets_.end())
{
fee_.update(Resource::feeUselessData, " duplicate (tsHAVE)");
fee_.update(Resource::feeUselessData, "duplicate (tsHAVE)");
return;
}

Expand All @@ -1970,7 +1970,7 @@ PeerImp::onValidatorListMessage(
JLOG(p_journal_.warn()) << "Ignored malformed " << messageType
<< " from peer " << remote_address_;
// This shouldn't ever happen with a well-behaved peer
fee_.update(Resource::feeHeavyBurdenPeer, " no blobs");
fee_.update(Resource::feeHeavyBurdenPeer, "no blobs");
return;
}

Expand All @@ -1987,7 +1987,7 @@ PeerImp::onValidatorListMessage(
// Charging this fee here won't hurt the peer in the normal
// course of operation (ie. refresh every 5 minutes), but
// will add up if the peer is misbehaving.
fee_.update(Resource::feeUselessData, " duplicate");
fee_.update(Resource::feeUselessData, "duplicate");
return;
}

Expand Down Expand Up @@ -2073,23 +2073,23 @@ PeerImp::onValidatorListMessage(
case ListDisposition::stale:
// There are very few good reasons for a peer to send an
// old list, particularly more than once.
fee_.update(Resource::feeInvalidData, " expired");
fee_.update(Resource::feeInvalidData, "expired");
break;
case ListDisposition::untrusted:
// Charging this fee here won't hurt the peer in the normal
// course of operation (ie. refresh every 5 minutes), but
// will add up if the peer is misbehaving.
fee_.update(Resource::feeUselessData, " untrusted");
fee_.update(Resource::feeUselessData, "untrusted");
break;
case ListDisposition::invalid:
// This shouldn't ever happen with a well-behaved peer
fee_.update(
Resource::feeInvalidSignature, " invalid list disposition");
Resource::feeInvalidSignature, "invalid list disposition");
break;
case ListDisposition::unsupported_version:
// During a version transition, this may be legitimate.
// If it happens frequently, that's probably bad.
fee_.update(Resource::feeInvalidData, " version");
fee_.update(Resource::feeInvalidData, "version");
break;
default:
assert(false);
Expand Down Expand Up @@ -2166,7 +2166,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidatorList> const& m)
<< "ValidatorList: received validator list from peer using "
<< "protocol version " << to_string(protocol_)
<< " which shouldn't support this feature.";
fee_.update(Resource::feeUselessData, " unsupported peer");
fee_.update(Resource::feeUselessData, "unsupported peer");
return;
}
onValidatorListMessage(
Expand All @@ -2180,7 +2180,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidatorList> const& m)
JLOG(p_journal_.warn()) << "ValidatorList: Exception, " << e.what()
<< " from peer " << remote_address_;
using namespace std::string_literals;
fee_.update(Resource::feeInvalidData, " "s + e.what());
fee_.update(Resource::feeInvalidData, e.what());
}
}

Expand All @@ -2196,7 +2196,7 @@ PeerImp::onMessage(
<< "ValidatorListCollection: received validator list from peer "
<< "using protocol version " << to_string(protocol_)
<< " which shouldn't support this feature.";
fee_.update(Resource::feeUselessData, " unsupported peer");
fee_.update(Resource::feeUselessData, "unsupported peer");
return;
}
else if (m->version() < 2)
Expand All @@ -2206,7 +2206,7 @@ PeerImp::onMessage(
"version "
<< m->version() << " from peer using protocol version "
<< to_string(protocol_);
fee_.update(Resource::feeInvalidData, " wrong version");
fee_.update(Resource::feeInvalidData, "wrong version");
return;
}
onValidatorListMessage(
Expand All @@ -2220,7 +2220,7 @@ PeerImp::onMessage(
JLOG(p_journal_.warn()) << "ValidatorListCollection: Exception, "
<< e.what() << " from peer " << remote_address_;
using namespace std::string_literals;
fee_.update(Resource::feeInvalidData, " "s + e.what());
fee_.update(Resource::feeInvalidData, e.what());
}
}

Expand All @@ -2230,7 +2230,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
if (m->validation().size() < 50)
{
JLOG(p_journal_.warn()) << "Validation: Too small";
fee_.update(Resource::feeMalformedRequest, " too small");
fee_.update(Resource::feeMalformedRequest, "too small");
return;
}

Expand Down Expand Up @@ -2258,7 +2258,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
val->getSeenTime()))
{
JLOG(p_journal_.trace()) << "Validation: Not current";
fee_.update(Resource::feeUselessData, " not current");
fee_.update(Resource::feeUselessData, "not current");
return;
}

Expand Down Expand Up @@ -2332,7 +2332,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
JLOG(p_journal_.warn())
<< "Exception processing validation: " << e.what();
using namespace std::string_literals;
fee_.update(Resource::feeMalformedRequest, " "s + e.what());
fee_.update(Resource::feeMalformedRequest, e.what());
}
}

Expand Down Expand Up @@ -2365,7 +2365,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMGetObjectByHash> const& m)
{
JLOG(p_journal_.error())
<< "TMGetObjectByHash: tx reduce-relay is disabled";
fee_.update(Resource::feeMalformedRequest, " disabled");
fee_.update(Resource::feeMalformedRequest, "disabled");
return;
}

Expand Down Expand Up @@ -2395,7 +2395,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMGetObjectByHash> const& m)
{
if (!stringIsUint256Sized(packet.ledgerhash()))
{
fee_.update(Resource::feeMalformedRequest, " ledger hash");
fee_.update(Resource::feeMalformedRequest, "ledger hash");
return;
}

Expand Down Expand Up @@ -2499,7 +2499,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMHaveTransactions> const& m)
{
JLOG(p_journal_.error())
<< "TMHaveTransactions: tx reduce-relay is disabled";
fee_.update(Resource::feeMalformedRequest, " disabled");
fee_.update(Resource::feeMalformedRequest, "disabled");
return;
}

Expand Down Expand Up @@ -2568,7 +2568,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMTransactions> const& m)
{
JLOG(p_journal_.error())
<< "TMTransactions: tx reduce-relay is disabled";
fee_.update(Resource::feeMalformedRequest, " disabled");
fee_.update(Resource::feeMalformedRequest, "disabled");
return;
}

Expand Down Expand Up @@ -2677,7 +2677,7 @@ PeerImp::doFetchPack(const std::shared_ptr<protocol::TMGetObjectByHash>& packet)
if (!stringIsUint256Sized(packet->ledgerhash()))
{
JLOG(p_journal_.warn()) << "FetchPack hash size malformed";
fee_.update(Resource::feeMalformedRequest, " hash size");
fee_.update(Resource::feeMalformedRequest, "hash size");
return;
}

Expand Down Expand Up @@ -2706,7 +2706,7 @@ PeerImp::doTransactions(
if (packet->objects_size() > reduce_relay::MAX_TX_QUEUE_SIZE)
{
JLOG(p_journal_.error()) << "doTransactions, invalid number of hashes";
fee_.update(Resource::feeMalformedRequest, " too big");
fee_.update(Resource::feeMalformedRequest, "too big");
return;
}

Expand All @@ -2716,7 +2716,7 @@ PeerImp::doTransactions(

if (!stringIsUint256Sized(obj.hash()))
{
fee_.update(Resource::feeMalformedRequest, " hash size");
fee_.update(Resource::feeMalformedRequest, "hash size");
return;
}

Expand All @@ -2728,7 +2728,7 @@ PeerImp::doTransactions(
{
JLOG(p_journal_.error()) << "doTransactions, transaction not found "
<< Slice(hash.data(), hash.size());
fee_.update(Resource::feeMalformedRequest, " tx not found");
fee_.update(Resource::feeMalformedRequest, "tx not found");
return;
}

Expand Down
4 changes: 4 additions & 0 deletions src/xrpld/overlay/detail/PeerImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ class PeerImp : public Peer,
{
assert(f >= fee);
fee = f;
if (!context.empty())
{
context += " ";
}
context += add;
}
};
Expand Down

0 comments on commit 7b63b8d

Please sign in to comment.