mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
The next part of the reserve/fee change code.
Conflicts: src/cpp/ripple/Application.cpp
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
<ClCompile Include="src\cpp\ripple\DBInit.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\DeterministicKeys.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\ECIES.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\FeatureTable.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\FieldNames.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\HashedObject.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\HTTPRequest.cpp" />
|
||||
|
||||
@@ -87,6 +87,9 @@
|
||||
<ClCompile Include="src\cpp\ripple\ECIES.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FeatureTable.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FieldNames.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
<ClCompile Include="src\cpp\ripple\ECIES.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FeatureTable.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\FieldNames.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -26,6 +26,8 @@ Application* theApp = NULL;
|
||||
|
||||
int DatabaseCon::sCount = 0;
|
||||
|
||||
// #define RESERVE_BASE_100
|
||||
|
||||
DatabaseCon::DatabaseCon(const std::string& strName, const char *initStrings[], int initCount)
|
||||
{
|
||||
++sCount;
|
||||
@@ -50,6 +52,13 @@ Application::Application() :
|
||||
mIOWork(mIOService), mAuxWork(mAuxService), mUNL(mIOService), mNetOps(mIOService, &mLedgerMaster),
|
||||
mTempNodeCache("NodeCache", 16384, 90), mHashedObjectStore(16384, 300), mSLECache("LedgerEntryCache", 4096, 120),
|
||||
mSNTPClient(mAuxService), mJobQueue(mIOService), mFeeTrack(),
|
||||
|
||||
#ifdef RESERVE_BASE_100
|
||||
mFeeVote(10, 100, 25),
|
||||
#else
|
||||
mFeeVote(10, 200, 50),
|
||||
#endif
|
||||
|
||||
mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL),
|
||||
mHashNodeDB(NULL), mNetNodeDB(NULL), mPathFindDB(NULL),
|
||||
mConnectionPool(mIOService), mPeerDoor(NULL), mRPCDoor(NULL), mWSPublicDoor(NULL), mWSPrivateDoor(NULL),
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "LedgerMaster.h"
|
||||
#include "UniqueNodeList.h"
|
||||
#include "ConnectionPool.h"
|
||||
#include "FeatureTable.h"
|
||||
#include "ScopedLock.h"
|
||||
#include "LedgerAcquire.h"
|
||||
#include "TransactionMaster.h"
|
||||
@@ -71,6 +72,7 @@ class Application
|
||||
LoadFeeTrack mFeeTrack;
|
||||
TXQueue mTxnQueue;
|
||||
OrderBookDB mOrderBookDB;
|
||||
FeeVote mFeeVote;
|
||||
|
||||
DatabaseCon *mRpcDB, *mTxnDB, *mLedgerDB, *mWalletDB, *mHashNodeDB, *mNetNodeDB, *mPathFindDB;
|
||||
|
||||
@@ -124,6 +126,7 @@ public:
|
||||
PeerDoor& getPeerDoor() { return *mPeerDoor; }
|
||||
OrderBookDB& getOrderBookDB() { return mOrderBookDB; }
|
||||
SLECache& getSLECache() { return mSLECache; }
|
||||
FeeVote& getFeeVote() { return mFeeVote; }
|
||||
|
||||
|
||||
bool isNew(const uint256& s) { return mSuppressions.addSuppression(s); }
|
||||
|
||||
@@ -236,4 +236,64 @@ Json::Value FeatureTable::getJson(int)
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<typename INT> class VotableInteger
|
||||
{
|
||||
protected:
|
||||
INT mCurrent; // The current setting
|
||||
INT mTarget; // The setting we want
|
||||
std::map<INT, int> mVoteMap;
|
||||
|
||||
VotableInteger(INT current, INT target) : mCurrent(current), mTarget(target)
|
||||
{
|
||||
++mVoteMap[mTarget]; // Add our vote
|
||||
}
|
||||
|
||||
bool mayVote()
|
||||
{
|
||||
return mCurrent != mTarget; // If we love the current setting, we will not vote
|
||||
}
|
||||
|
||||
void addVote(INT vote)
|
||||
{
|
||||
++mVoteMap[vote];
|
||||
}
|
||||
|
||||
void noVote()
|
||||
{
|
||||
addVote(mCurrent);
|
||||
}
|
||||
|
||||
INT getVotes()
|
||||
{
|
||||
INT ourVote = mCurrent;
|
||||
int weight = 0;
|
||||
|
||||
typedef std::pair<INT, int> INTint_pair_t;
|
||||
BOOST_FOREACH(INTint_pair_t& value, mVoteMap)
|
||||
{ // Take most voted value between current and target, inclusive
|
||||
if ((value.first <= std::max(mTarget, mCurrent)) &&
|
||||
(value.first >= std::min(mTarget, mCurrent)) &&
|
||||
(value.second > weight))
|
||||
{
|
||||
ourVote = value.first;
|
||||
weight = value.second;
|
||||
}
|
||||
}
|
||||
|
||||
return ourVote;
|
||||
}
|
||||
};
|
||||
|
||||
void FeeVote::doFeeVoting(Ledger::ref lastClosedLedger, SHAMap::ref initialPosition)
|
||||
{
|
||||
// LCL must be flag ledger
|
||||
assert((lastClosedLedger->getLedgerSeq() % 256) == 0);
|
||||
|
||||
// get validations for ledger before flag
|
||||
|
||||
// choose our positions
|
||||
|
||||
// add transactions to our position
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "../json/value.h"
|
||||
|
||||
#include "uint256.h"
|
||||
#include "Ledger.h"
|
||||
|
||||
class FeatureSet
|
||||
{ // the status of all features requested in a given window
|
||||
@@ -77,4 +77,25 @@ public:
|
||||
Json::Value getJson(int);
|
||||
};
|
||||
|
||||
class FeeVote
|
||||
{
|
||||
protected:
|
||||
|
||||
// What we'd like to see
|
||||
uint64 mTargetBaseFee;
|
||||
uint32 mTargetReserveBase, mTargetReserveIncrement;
|
||||
|
||||
|
||||
public:
|
||||
FeeVote(uint64 targetBaseFee, uint32 targetReserveBase, uint32 targetReserveIncrement) :
|
||||
mTargetBaseFee(targetBaseFee),
|
||||
mTargetReserveBase(targetReserveBase),
|
||||
mTargetReserveIncrement(targetReserveIncrement)
|
||||
{ ; }
|
||||
|
||||
void doValidation(STObject& baseValidation);
|
||||
|
||||
void doFeeVoting(Ledger::ref lastClosedLedger, SHAMap::ref initialPosition);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user