Adjust our remote load fee based on validations.

This commit is contained in:
JoelKatz
2013-07-10 17:10:00 -07:00
parent e87cefd979
commit ac4843bc00
4 changed files with 44 additions and 3 deletions

View File

@@ -73,6 +73,7 @@ void LedgerMaster::pushLedger (Ledger::pointer newLedger)
// Caller should already have properly assembled this ledger into "ready-to-close" form --
// all candidate transactions must already be applied
WriteLog (lsINFO, LedgerMaster) << "PushLedger: " << newLedger->getHash ();
boost::recursive_mutex::scoped_lock ml (mLock);
if (!mPubLedger)
@@ -662,6 +663,16 @@ void LedgerMaster::checkAccept (uint256 const& hash, uint32 seq)
mValidLedger = ledger;
uint64 fee, fee2, ref;
ref = getApp().getFeeTrack().getLoadBase();
int count = getApp().getValidations().getFeeAverage(ledger->getHash(), ref, fee);
int count2 = getApp().getValidations().getFeeAverage(ledger->getParentHash(), ref, fee2);
if ((count + count2) == 0)
getApp().getFeeTrack().setRemoteFee(ref);
else
getApp().getFeeTrack().setRemoteFee(((fee * count) + (fee2 * count2)) / (count + count2));
tryPublish ();
}