If load is high, put load level in validations.

This commit is contained in:
JoelKatz
2013-07-10 16:49:30 -07:00
parent aeae0fcf11
commit e87cefd979
2 changed files with 14 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ void LedgerConsensus::checkOurValidation ()
uint256 signingHash;
SerializedValidation::pointer v = boost::make_shared<SerializedValidation>
(mPreviousLedger->getHash (), getApp().getOPs ().getValidationTimeNC (), mValPublic, false);
addLoad(v);
v->setTrusted ();
v->sign (signingHash, mValPrivate);
getApp().getHashRouter ().addSuppression (signingHash);
@@ -1247,6 +1248,7 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer)
SerializedValidation::pointer v = boost::make_shared<SerializedValidation>
(newLCLHash, getApp().getOPs ().getValidationTimeNC (), mValPublic, mProposing);
v->setFieldU32 (sfLedgerSequence, newLCL->getLedgerSeq ());
addLoad(v);
if (((newLCL->getLedgerSeq () + 1) % 256) == 0) // next ledger is flag ledger
{
@@ -1333,6 +1335,16 @@ void LedgerConsensus::endConsensus ()
getApp().getOPs ().endConsensus (mHaveCorrectLCL);
}
void LedgerConsensus::addLoad(SerializedValidation::ref val)
{
uint32 fee = std::max(
getApp().getFeeTrack().getLocalFee(),
getApp().getFeeTrack().getClusterFee());
uint32 ref = getApp().getFeeTrack().getLoadBase();
if (fee > ref)
val->setFieldU32(sfLoadFee, fee);
}
void LedgerConsensus::simulate ()
{
WriteLog (lsINFO, LedgerConsensus) << "Simulating consensus";

View File

@@ -108,6 +108,8 @@ private:
void beginAccept (bool synchronous);
void endConsensus ();
void addLoad (SerializedValidation::ref val);
private:
// VFALCO TODO Rename these to look pretty
enum LCState