mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 03:55:53 +00:00
Check amendment block status and update w/ ledgers:
Check and modify amendment blocked status with each new ledger (provided by @wilsonianb). Honor blocked status in certain RPC commands and when deciding whether to propose/validate. Fixes: RIPD-1479 Fixes: RIPD-1447 Release Notes ------------- This resolves an issue whereby an amendment blocked server would still serve some RPC requests that are unreliable in blocked state and would continue to publish validations.
This commit is contained in:
@@ -157,6 +157,9 @@ protected:
|
||||
// we haven't participated in one yet.
|
||||
std::unique_ptr <AmendmentSet> lastVote_;
|
||||
|
||||
// True if an unsupported amendment is enabled
|
||||
bool unsupportedEnabled_;
|
||||
|
||||
beast::Journal j_;
|
||||
|
||||
// Finds or creates state
|
||||
@@ -187,6 +190,8 @@ public:
|
||||
bool isEnabled (uint256 const& amendment) override;
|
||||
bool isSupported (uint256 const& amendment) override;
|
||||
|
||||
bool hasUnsupportedEnabled () override;
|
||||
|
||||
Json::Value getJson (int) override;
|
||||
Json::Value getJson (uint256 const&) override;
|
||||
|
||||
@@ -222,6 +227,7 @@ AmendmentTableImpl::AmendmentTableImpl (
|
||||
: lastUpdateSeq_ (0)
|
||||
, majorityTime_ (majorityTime)
|
||||
, majorityFraction_ (majorityFraction)
|
||||
, unsupportedEnabled_ (false)
|
||||
, j_ (journal)
|
||||
{
|
||||
assert (majorityFraction_ != 0);
|
||||
@@ -340,6 +346,14 @@ AmendmentTableImpl::enable (uint256 const& amendment)
|
||||
return false;
|
||||
|
||||
s->enabled = true;
|
||||
|
||||
if (! s->supported)
|
||||
{
|
||||
JLOG (j_.error()) <<
|
||||
"Unsupported amendment " << amendment << " activated.";
|
||||
unsupportedEnabled_ = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -372,6 +386,13 @@ AmendmentTableImpl::isSupported (uint256 const& amendment)
|
||||
return s && s->supported;
|
||||
}
|
||||
|
||||
bool
|
||||
AmendmentTableImpl::hasUnsupportedEnabled ()
|
||||
{
|
||||
std::lock_guard <std::mutex> sl (mutex_);
|
||||
return unsupportedEnabled_;
|
||||
}
|
||||
|
||||
std::vector <uint256>
|
||||
AmendmentTableImpl::doValidation (
|
||||
std::set<uint256> const& enabled)
|
||||
@@ -523,10 +544,8 @@ AmendmentTableImpl::doValidatedLedger (
|
||||
LedgerIndex ledgerSeq,
|
||||
std::set<uint256> const& enabled)
|
||||
{
|
||||
std::lock_guard <std::mutex> sl (mutex_);
|
||||
|
||||
for (auto& e : amendmentMap_)
|
||||
e.second.enabled = (enabled.count (e.first) != 0);
|
||||
for (auto& e : enabled)
|
||||
enable(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user