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:
JoelKatz
2016-11-21 11:04:18 -08:00
committed by Nik Bougalis
parent dc3571184a
commit e00a6b0e5a
9 changed files with 87 additions and 10 deletions

View File

@@ -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,