Don't raise txn fees so quickly.

This commit is contained in:
JoelKatz
2013-03-05 09:26:55 -08:00
parent ecb9e7db26
commit 231a514265
2 changed files with 7 additions and 1 deletions

View File

@@ -245,6 +245,10 @@ void LoadFeeTrack::setRemoteFee(uint32 f)
bool LoadFeeTrack::raiseLocalFee()
{
boost::mutex::scoped_lock sl(mLock);
if (++raiseCount < 2)
return false;
uint32 origFee = mLocalTxnLoadFee;
if (mLocalTxnLoadFee < mRemoteTxnLoadFee) // make sure this fee takes effect
@@ -265,6 +269,7 @@ bool LoadFeeTrack::lowerLocalFee()
{
boost::mutex::scoped_lock sl(mLock);
uint32 origFee = mLocalTxnLoadFee;
raiseCount = 0;
mLocalTxnLoadFee -= (mLocalTxnLoadFee / lftFeeDecFraction ); // reduce by 1/4

View File

@@ -139,6 +139,7 @@ protected:
uint32 mLocalTxnLoadFee; // Scale factor, lftNormalFee = normal fee
uint32 mRemoteTxnLoadFee; // Scale factor, lftNormalFee = normal fee
int raiseCount;
boost::mutex mLock;
@@ -146,7 +147,7 @@ protected:
public:
LoadFeeTrack() : mLocalTxnLoadFee(lftNormalFee), mRemoteTxnLoadFee(lftNormalFee)
LoadFeeTrack() : mLocalTxnLoadFee(lftNormalFee), mRemoteTxnLoadFee(lftNormalFee), raiseCount(0)
{ ; }
// Scale from fee units to millionths of a ripple