diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp index a2dcdf469..a6d23d3b5 100644 --- a/src/cpp/ripple/Application.cpp +++ b/src/cpp/ripple/Application.cpp @@ -429,6 +429,8 @@ void Application::startNewLedger() { Ledger::pointer firstLedger = boost::make_shared(rootAddress, SYSTEM_CURRENCY_START); assert(!!firstLedger->getAccountState(rootAddress)); + // WRITEME: Add any default features + // WRITEME: Set default fee/reserve firstLedger->updateHash(); firstLedger->setClosed(); firstLedger->setAccepted(); diff --git a/src/cpp/ripple/FeatureTable.cpp b/src/cpp/ripple/FeatureTable.cpp index e76e7cb15..eff8a8be2 100644 --- a/src/cpp/ripple/FeatureTable.cpp +++ b/src/cpp/ripple/FeatureTable.cpp @@ -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()) diff --git a/src/cpp/ripple/FeatureTable.h b/src/cpp/ripple/FeatureTable.h index 9579f4019..79c9f1f65 100644 --- a/src/cpp/ripple/FeatureTable.h +++ b/src/cpp/ripple/FeatureTable.h @@ -18,23 +18,31 @@ public: void addVote(const uint256& feature) { ++mVotes[feature]; } }; +class FeatureState +{ +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), mDefault(false), + mFirstMajority(0), mLastMajority(0) { ; } + + void setVeto() { mVetoed = true; } + void setDefault() { mDefault = true; } +}; + + class FeatureTable { protected: - class FeatureState - { - public: - bool mVetoed; // We don't want this feature enabled - bool mEnabled; - bool mSupported; - - 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) { ; } - }; - typedef boost::unordered_map featureMap_t; typedef std::pair featureIt_t; typedef boost::unordered_set featureList_t;