mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Logging & minor optimizations:
* Log load fee values (at debug) received from validations. * Log remote and cluster fee values (at trace) when changed. * Refactor JobQueue::isOverloaded to return sooner if overloaded. * Refactor Transactor::checkFee to only compute fee if ledger is open.
This commit is contained in:
committed by
Nik Bougalis
parent
8ca2d98496
commit
aaa601841c
@@ -1080,6 +1080,16 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
|
||||
if (!fees.empty())
|
||||
{
|
||||
std::sort(fees.begin(), fees.end());
|
||||
if (auto stream = m_journal.debug())
|
||||
{
|
||||
std::stringstream s;
|
||||
s << "Received fees from validations: (" << fees.size() << ") ";
|
||||
for (auto const fee1 : fees)
|
||||
{
|
||||
s << " " << fee1;
|
||||
}
|
||||
stream << s.str();
|
||||
}
|
||||
fee = fees[fees.size() / 2]; // median
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_CORE_LOADFEETRACK_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/FeeUnits.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <algorithm>
|
||||
@@ -58,6 +59,7 @@ public:
|
||||
void
|
||||
setRemoteFee(std::uint32_t f)
|
||||
{
|
||||
JLOG(j_.trace()) << "setRemoteFee: " << f;
|
||||
std::lock_guard sl(lock_);
|
||||
remoteTxnLoadFee_ = f;
|
||||
}
|
||||
@@ -110,6 +112,7 @@ public:
|
||||
void
|
||||
setClusterFee(std::uint32_t fee)
|
||||
{
|
||||
JLOG(j_.trace()) << "setClusterFee: " << fee;
|
||||
std::lock_guard sl(lock_);
|
||||
clusterTxnLoadFee_ = fee;
|
||||
}
|
||||
|
||||
@@ -174,15 +174,19 @@ Transactor::checkFee(PreclaimContext const& ctx, FeeUnit64 baseFee)
|
||||
if (!isLegalAmount(feePaid) || feePaid < beast::zero)
|
||||
return temBAD_FEE;
|
||||
|
||||
auto const feeDue =
|
||||
minimumFee(ctx.app, baseFee, ctx.view.fees(), ctx.flags);
|
||||
|
||||
// Only check fee is sufficient when the ledger is open.
|
||||
if (ctx.view.open() && feePaid < feeDue)
|
||||
if (ctx.view.open())
|
||||
{
|
||||
JLOG(ctx.j.trace()) << "Insufficient fee paid: " << to_string(feePaid)
|
||||
<< "/" << to_string(feeDue);
|
||||
return telINSUF_FEE_P;
|
||||
auto const feeDue =
|
||||
minimumFee(ctx.app, baseFee, ctx.view.fees(), ctx.flags);
|
||||
|
||||
if (feePaid < feeDue)
|
||||
{
|
||||
JLOG(ctx.j.trace())
|
||||
<< "Insufficient fee paid: " << to_string(feePaid) << "/"
|
||||
<< to_string(feeDue);
|
||||
return telINSUF_FEE_P;
|
||||
}
|
||||
}
|
||||
|
||||
if (feePaid == beast::zero)
|
||||
|
||||
@@ -168,15 +168,13 @@ JobQueue::addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed)
|
||||
bool
|
||||
JobQueue::isOverloaded()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (auto& x : m_jobData)
|
||||
{
|
||||
if (x.second.load().isOver())
|
||||
++count;
|
||||
return true;
|
||||
}
|
||||
|
||||
return count > 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
Json::Value
|
||||
|
||||
Reference in New Issue
Block a user