mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +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);
|
Ledger::pointer firstLedger = boost::make_shared<Ledger>(rootAddress, SYSTEM_CURRENCY_START);
|
||||||
assert(!!firstLedger->getAccountState(rootAddress));
|
assert(!!firstLedger->getAccountState(rootAddress));
|
||||||
|
// WRITEME: Add any default features
|
||||||
|
// WRITEME: Set default fee/reserve
|
||||||
firstLedger->updateHash();
|
firstLedger->updateHash();
|
||||||
firstLedger->setClosed();
|
firstLedger->setClosed();
|
||||||
firstLedger->setAccepted();
|
firstLedger->setAccepted();
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ SETUP_LOG (FeatureTable)
|
|||||||
|
|
||||||
void FeatureTable::addInitialFeatures()
|
void FeatureTable::addInitialFeatures()
|
||||||
{
|
{
|
||||||
// For each feature this version supports, call enableFeature.
|
// For each feature this version supports, construct the FeatureState object by calling
|
||||||
// Permanent vetos can also be added here.
|
// 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
|
{ // call with the mutex held
|
||||||
featureMap_t::iterator it = mFeatureMap.find(featureHash);
|
featureMap_t::iterator it = mFeatureMap.find(featureHash);
|
||||||
if (it == mFeatureMap.end())
|
if (it == mFeatureMap.end())
|
||||||
|
|||||||
@@ -18,23 +18,31 @@ public:
|
|||||||
void addVote(const uint256& feature) { ++mVotes[feature]; }
|
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
|
class FeatureTable
|
||||||
{
|
{
|
||||||
protected:
|
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<uint256, FeatureState> featureMap_t;
|
typedef boost::unordered_map<uint256, FeatureState> featureMap_t;
|
||||||
typedef std::pair<const uint256, FeatureState> featureIt_t;
|
typedef std::pair<const uint256, FeatureState> featureIt_t;
|
||||||
typedef boost::unordered_set<uint256> featureList_t;
|
typedef boost::unordered_set<uint256> featureList_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user