mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 13:35:54 +00:00
Missing piece.
This commit is contained in:
@@ -91,7 +91,7 @@ FeatureTable::featureList_t FeatureTable::getEnabledFeatures()
|
|||||||
|
|
||||||
bool FeatureTable::shouldEnable(uint32 closeTime, const FeatureState& fs)
|
bool FeatureTable::shouldEnable(uint32 closeTime, const FeatureState& fs)
|
||||||
{
|
{
|
||||||
if (fs.mVetoed || fs.mEnabled || (fs.mLastMajority != mLastReport))
|
if (fs.mVetoed || fs.mEnabled || !fs.mSupported || (fs.mLastMajority != mLastReport))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (fs.mFirstMajority == mFirstReport)
|
if (fs.mFirstMajority == mFirstReport)
|
||||||
@@ -173,6 +173,19 @@ void FeatureTable::setEnabledFeatures(const std::vector<uint256>& features)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FeatureTable::setSupportedFeatures(const std::vector<uint256>& features)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock sl(mMutex);
|
||||||
|
BOOST_FOREACH(featureIt_t& it, mFeatureMap)
|
||||||
|
{
|
||||||
|
it.second.mSupported = false;
|
||||||
|
}
|
||||||
|
BOOST_FOREACH(const uint256& it, features)
|
||||||
|
{
|
||||||
|
mFeatureMap[it].mSupported = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Json::Value FeatureTable::getJson(int)
|
Json::Value FeatureTable::getJson(int)
|
||||||
{
|
{
|
||||||
Json::Value ret(Json::objectValue);
|
Json::Value ret(Json::objectValue);
|
||||||
@@ -182,6 +195,8 @@ Json::Value FeatureTable::getJson(int)
|
|||||||
{
|
{
|
||||||
Json::Value v(Json::objectValue);
|
Json::Value v(Json::objectValue);
|
||||||
|
|
||||||
|
v["supported"] = it.second.mSupported ? "true" : "false";
|
||||||
|
|
||||||
if (it.second.mEnabled)
|
if (it.second.mEnabled)
|
||||||
v["enabled"] = "true";
|
v["enabled"] = "true";
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -29,11 +29,12 @@ protected:
|
|||||||
public:
|
public:
|
||||||
bool mVetoed; // We don't want this feature enabled
|
bool mVetoed; // We don't want this feature enabled
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
bool mSupported;
|
||||||
|
|
||||||
uint32 mFirstMajority; // First time we saw a majority (close time)
|
uint32 mFirstMajority; // First time we saw a majority (close time)
|
||||||
uint32 mLastMajority; // Most recent time we saw a majority (close time)
|
uint32 mLastMajority; // Most recent time we saw a majority (close time)
|
||||||
|
|
||||||
FeatureState() : mVetoed(false), mEnabled(false), mFirstMajority(0), mLastMajority(0) { ; }
|
FeatureState() : mVetoed(false), mEnabled(false), mSupported(false), mFirstMajority(0), mLastMajority(0) { ; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::unordered_map<uint256, FeatureState> featureMap_t;
|
typedef boost::unordered_map<uint256, FeatureState> featureMap_t;
|
||||||
@@ -65,6 +66,7 @@ public:
|
|||||||
bool isFeatureEnabled(const uint256& feature);
|
bool isFeatureEnabled(const uint256& feature);
|
||||||
|
|
||||||
void setEnabledFeatures(const std::vector<uint256>& features);
|
void setEnabledFeatures(const std::vector<uint256>& features);
|
||||||
|
void setSupportedFeatures(const std::vector<uint256>& features);
|
||||||
|
|
||||||
featureList_t getVetoedFeatures();
|
featureList_t getVetoedFeatures();
|
||||||
featureList_t getEnabledFeatures();
|
featureList_t getEnabledFeatures();
|
||||||
|
|||||||
Reference in New Issue
Block a user