mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Enable amendments in genesis ledger (RIPD-1281)
When started with "--start", put all known, non-vetoed amendments in the genesis ledger. This avoids the need to wait 256 ledgers before amendments are enabled when testing with a fresh ledger.
This commit is contained in:
@@ -85,6 +85,13 @@ public:
|
||||
virtual std::vector <uint256>
|
||||
doValidation (std::set <uint256> const& enabled) = 0;
|
||||
|
||||
// The set of amendments to enable in the genesis ledger
|
||||
// This will return all known, non-vetoed amendments.
|
||||
// If we ever have two amendments that should not both be
|
||||
// enabled at the same time, we should ensure one is vetoed.
|
||||
virtual std::vector <uint256>
|
||||
getDesired () = 0;
|
||||
|
||||
// The two function below adapt the API callers expect to the
|
||||
// internal amendment table API. This allows the amendment
|
||||
// table implementation to be independent of the ledger
|
||||
|
||||
@@ -199,6 +199,9 @@ public:
|
||||
std::vector <uint256>
|
||||
doValidation (std::set<uint256> const& enabledAmendments) override;
|
||||
|
||||
std::vector <uint256>
|
||||
getDesired () override;
|
||||
|
||||
std::map <uint256, std::uint32_t>
|
||||
doVoting (
|
||||
NetClock::time_point closeTime,
|
||||
@@ -396,6 +399,31 @@ AmendmentTableImpl::doValidation (
|
||||
return amendments;
|
||||
}
|
||||
|
||||
std::vector <uint256>
|
||||
AmendmentTableImpl::getDesired ()
|
||||
{
|
||||
// Get the list of amendments we support and do not
|
||||
// veto
|
||||
std::vector <uint256> amendments;
|
||||
amendments.reserve (amendmentMap_.size());
|
||||
|
||||
{
|
||||
std::lock_guard <std::mutex> sl (mutex_);
|
||||
for (auto const& e : amendmentMap_)
|
||||
{
|
||||
if (e.second.supported && ! e.second.vetoed)
|
||||
{
|
||||
amendments.push_back (e.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!amendments.empty())
|
||||
std::sort (amendments.begin (), amendments.end ());
|
||||
|
||||
return amendments;
|
||||
}
|
||||
|
||||
std::map <uint256, std::uint32_t>
|
||||
AmendmentTableImpl::doVoting (
|
||||
NetClock::time_point closeTime,
|
||||
|
||||
Reference in New Issue
Block a user