mirror of
https://github.com/XRPLF/rippled.git
synced 2026-03-16 01:32:23 +00:00
Compare commits
25 Commits
develop
...
ximinez/le
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8afba1d8cd | ||
|
|
72ebea20f6 | ||
|
|
e15972d239 | ||
|
|
cd740beed3 | ||
|
|
e80b95b1fc | ||
|
|
2d616f194c | ||
|
|
976932566e | ||
|
|
48dcac476d | ||
|
|
5e0f1d2ddf | ||
|
|
74f2003db6 | ||
|
|
7a72b54ba7 | ||
|
|
87776e3114 | ||
|
|
3523f8828c | ||
|
|
058080f6cd | ||
|
|
a646956271 | ||
|
|
7c59b7e064 | ||
|
|
a1f7e1fd78 | ||
|
|
ca06325ed9 | ||
|
|
ca8ef9bf0c | ||
|
|
74875e9ab8 | ||
|
|
f71c7f1959 | ||
|
|
049e12bfd6 | ||
|
|
6fbd1360d6 | ||
|
|
d0810d3cbe | ||
|
|
9568ea0f02 |
@@ -116,12 +116,47 @@ Rules::presets() const
|
||||
return impl_->presets();
|
||||
}
|
||||
|
||||
/** Define features that can be considered enabled based on other features.
|
||||
*
|
||||
* This is a simple key-value map where
|
||||
* - the key is the feature being checked
|
||||
* - the value is a set of other features, which, in any of them are enabled,
|
||||
* will cause the key feature to be considered enabled.
|
||||
*
|
||||
*/
|
||||
std::map<uint256, std::vector<uint256>> const&
|
||||
getTransitiveFeatureMap()
|
||||
{
|
||||
static std::map<uint256, std::vector<uint256>> const featureToOverride{
|
||||
// In this example, if LendingProtocol is enabled, then
|
||||
// SingleAssetVault can also be considered enabled. This example
|
||||
// is commented because both amendments have been released as
|
||||
// supported, and this would change their behaviors. Only new
|
||||
// amendments my be included in the value set.
|
||||
//
|
||||
// {featureSingleAssetVault, {featureLendingProtocol}},
|
||||
};
|
||||
return featureToOverride;
|
||||
}
|
||||
|
||||
bool
|
||||
Rules::enabled(uint256 const& feature) const
|
||||
{
|
||||
XRPL_ASSERT(impl_, "xrpl::Rules::enabled : initialized");
|
||||
|
||||
return impl_->enabled(feature);
|
||||
if (impl_->enabled(feature))
|
||||
return true;
|
||||
|
||||
// Some features can be considered enabled based on other enabled features.
|
||||
static auto const& transitiveFeatureMap = getTransitiveFeatureMap();
|
||||
// If this feature is not one of them, then we're done.
|
||||
if (!transitiveFeatureMap.contains(feature))
|
||||
return false;
|
||||
|
||||
auto const& transitiveFeatures = transitiveFeatureMap.at(feature);
|
||||
return std::any_of(transitiveFeatures.begin(), transitiveFeatures.end(), [this](auto const& f) {
|
||||
return impl_->enabled(f);
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user