mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-30 16:05:51 +00:00
Static feature support.
This commit is contained in:
@@ -429,6 +429,8 @@ void Application::startNewLedger()
|
||||
{
|
||||
Ledger::pointer firstLedger = boost::make_shared<Ledger>(rootAddress, SYSTEM_CURRENCY_START);
|
||||
assert(!!firstLedger->getAccountState(rootAddress));
|
||||
// WRITEME: Add any default features
|
||||
// WRITEME: Set default fee/reserve
|
||||
firstLedger->updateHash();
|
||||
firstLedger->setClosed();
|
||||
firstLedger->setAccepted();
|
||||
|
||||
@@ -3,11 +3,11 @@ SETUP_LOG (FeatureTable)
|
||||
|
||||
void FeatureTable::addInitialFeatures()
|
||||
{
|
||||
// For each feature this version supports, call enableFeature.
|
||||
// Permanent vetos can also be added here.
|
||||
// For each feature this version supports, construct the FeatureState object by calling
|
||||
// getCreateFeature. Set any vetoes or defaults. A pointer to the FeatureState can be stashed
|
||||
}
|
||||
|
||||
FeatureTable::FeatureState* FeatureTable::getCreateFeature(const uint256& featureHash, bool create)
|
||||
FeatureState* FeatureTable::getCreateFeature(const uint256& featureHash, bool create)
|
||||
{ // call with the mutex held
|
||||
featureMap_t::iterator it = mFeatureMap.find(featureHash);
|
||||
if (it == mFeatureMap.end())
|
||||
|
||||
@@ -18,22 +18,30 @@ public:
|
||||
void addVote(const uint256& feature) { ++mVotes[feature]; }
|
||||
};
|
||||
|
||||
class FeatureTable
|
||||
class FeatureState
|
||||
{
|
||||
protected:
|
||||
|
||||
class FeatureState
|
||||
{
|
||||
public:
|
||||
public:
|
||||
uint256 mHash; // Feature hash
|
||||
bool mVetoed; // We don't want this feature enabled
|
||||
bool mEnabled;
|
||||
bool mSupported;
|
||||
bool mDefault; // Include in genesis ledger
|
||||
|
||||
uint32 mFirstMajority; // First time we saw a majority (close time)
|
||||
uint32 mLastMajority; // Most recent time we saw a majority (close time)
|
||||
|
||||
FeatureState() : mVetoed(false), mEnabled(false), mSupported(false), mFirstMajority(0), mLastMajority(0) { ; }
|
||||
};
|
||||
FeatureState()
|
||||
: mVetoed(false), mEnabled(false), mSupported(false), mDefault(false),
|
||||
mFirstMajority(0), mLastMajority(0) { ; }
|
||||
|
||||
void setVeto() { mVetoed = true; }
|
||||
void setDefault() { mDefault = true; }
|
||||
};
|
||||
|
||||
|
||||
class FeatureTable
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef boost::unordered_map<uint256, FeatureState> featureMap_t;
|
||||
typedef std::pair<const uint256, FeatureState> featureIt_t;
|
||||
|
||||
Reference in New Issue
Block a user