mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 06:25:51 +00:00
Make sure all fee schedule changes are reported to clients.
This commit is contained in:
@@ -242,7 +242,7 @@ void LoadFeeTrack::setRemoteFee(uint32 f)
|
||||
mRemoteTxnLoadFee = f;
|
||||
}
|
||||
|
||||
void LoadFeeTrack::raiseLocalFee()
|
||||
bool LoadFeeTrack::raiseLocalFee()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
uint32 origFee = mLocalTxnLoadFee;
|
||||
@@ -255,11 +255,13 @@ void LoadFeeTrack::raiseLocalFee()
|
||||
if (mLocalTxnLoadFee > lftFeeMax)
|
||||
mLocalTxnLoadFee = lftFeeMax;
|
||||
|
||||
tLog(origFee != mLocalTxnLoadFee, lsDEBUG) <<
|
||||
"Local load fee raised from " << origFee << " to " << mLocalTxnLoadFee;
|
||||
if (origFee == mLocalTxnLoadFee)
|
||||
return false;
|
||||
cLog(lsDEBUG) << "Local load fee raised from " << origFee << " to " << mLocalTxnLoadFee;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadFeeTrack::lowerLocalFee()
|
||||
bool LoadFeeTrack::lowerLocalFee()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
uint32 origFee = mLocalTxnLoadFee;
|
||||
@@ -269,8 +271,10 @@ void LoadFeeTrack::lowerLocalFee()
|
||||
if (mLocalTxnLoadFee < lftNormalFee)
|
||||
mLocalTxnLoadFee = lftNormalFee;
|
||||
|
||||
tLog(origFee != mLocalTxnLoadFee, lsDEBUG) <<
|
||||
"Local load fee lowered from " << origFee << " to " << mLocalTxnLoadFee;
|
||||
if (origFee == mLocalTxnLoadFee)
|
||||
return false;
|
||||
cLog(lsDEBUG) << "Local load fee lowered from " << origFee << " to " << mLocalTxnLoadFee;
|
||||
return true;
|
||||
}
|
||||
|
||||
Json::Value LoadFeeTrack::getJson(uint64 baseFee, uint32 referenceFeeUnits)
|
||||
@@ -312,10 +316,13 @@ void LoadManager::threadEntry()
|
||||
++mUptime;
|
||||
}
|
||||
|
||||
bool change;
|
||||
if (theApp->getJobQueue().isOverloaded())
|
||||
theApp->getFeeTrack().raiseLocalFee();
|
||||
change = theApp->getFeeTrack().raiseLocalFee();
|
||||
else
|
||||
theApp->getFeeTrack().lowerLocalFee();
|
||||
change = theApp->getFeeTrack().lowerLocalFee();
|
||||
if (change)
|
||||
theApp->getOPs().reportFeeChange();
|
||||
|
||||
t += boost::posix_time::seconds(1);
|
||||
boost::posix_time::time_duration when = t - boost::posix_time::microsec_clock::universal_time();
|
||||
|
||||
@@ -164,8 +164,8 @@ public:
|
||||
Json::Value getJson(uint64 baseFee, uint32 referenceFeeUnits);
|
||||
|
||||
void setRemoteFee(uint32);
|
||||
void raiseLocalFee();
|
||||
void lowerLocalFee();
|
||||
bool raiseLocalFee();
|
||||
bool lowerLocalFee();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ void InfoSub::onSendEmpty()
|
||||
NetworkOPs::NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster) :
|
||||
mMode(omDISCONNECTED), mNeedNetworkLedger(false), mProposing(false), mValidating(false),
|
||||
mNetTimer(io_service), mLedgerMaster(pLedgerMaster), mCloseTimeOffset(0), mLastCloseProposers(0),
|
||||
mLastCloseConvergeTime(1000 * LEDGER_IDLE_INTERVAL), mLastValidationTime(0)
|
||||
mLastCloseConvergeTime(1000 * LEDGER_IDLE_INTERVAL), mLastValidationTime(0),
|
||||
mLastLoadBase(256), mLastLoadFactor(256)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1020,8 +1021,8 @@ void NetworkOPs::pubServer()
|
||||
|
||||
jvObj["type"] = "serverStatus";
|
||||
jvObj["server_status"] = strOperatingMode();
|
||||
jvObj["load_base"] = theApp->getFeeTrack().getLoadBase();
|
||||
jvObj["load_factor"] = theApp->getFeeTrack().getLoadFactor();
|
||||
jvObj["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
|
||||
jvObj["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
|
||||
|
||||
BOOST_FOREACH(InfoSub* ispListener, mSubServer)
|
||||
{
|
||||
@@ -1285,6 +1286,15 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkOPs::reportFeeChange()
|
||||
{
|
||||
if ((theApp->getFeeTrack().getLoadBase() == mLastLoadBase) &&
|
||||
(theApp->getFeeTrack().getLoadFactor() == mLastLoadFactor))
|
||||
return;
|
||||
|
||||
theApp->getJobQueue().addJob(jtCLIENT, boost::bind(&NetworkOPs::pubServer, this));
|
||||
}
|
||||
|
||||
Json::Value NetworkOPs::transJson(const SerializedTransaction& stTxn, TER terResult, bool bAccepted, Ledger::ref lpCurrent, const std::string& strType)
|
||||
{
|
||||
Json::Value jvObj(Json::objectValue);
|
||||
|
||||
@@ -116,6 +116,9 @@ protected:
|
||||
boost::recursive_mutex mWantedHashLock;
|
||||
boost::unordered_set<uint256> mWantedHashes;
|
||||
|
||||
uint32 mLastLoadBase;
|
||||
uint32 mLastLoadFactor;
|
||||
|
||||
void setMode(OperatingMode);
|
||||
|
||||
Json::Value transJson(const SerializedTransaction& stTxn, TER terResult, bool bAccepted, Ledger::ref lpCurrent, const std::string& strType);
|
||||
@@ -257,6 +260,7 @@ public:
|
||||
std::list<LedgerProposal::pointer> >& peekStoredProposals() { return mStoredProposals; }
|
||||
void storeProposal(LedgerProposal::ref proposal, const RippleAddress& peerPublic);
|
||||
uint256 getConsensusLCL();
|
||||
void reportFeeChange();
|
||||
|
||||
bool addWantedHash(const uint256& h);
|
||||
bool isWantedHash(const uint256& h, bool remove);
|
||||
|
||||
Reference in New Issue
Block a user