20#include <xrpl/basics/LocalValue.h>
21#include <xrpl/protocol/Feature.h>
22#include <xrpl/protocol/Rules.h>
30LocalValue<std::optional<Rules>>&
31getCurrentTransactionRulesRef()
33 static LocalValue<std::optional<Rules>> r;
41 return *getCurrentTransactionRulesRef();
47 *getCurrentTransactionRulesRef() = std::move(r);
69 set_.reserve(amendments.size());
70 set_.insert(amendments.begin(), amendments.end());
84 return set_.count(feature) > 0;
96 "ripple::Rules::Impl::operator==(Impl) const : input presets do "
103 : impl_(
std::make_shared<
Impl>(presets))
118 return impl_->presets();
124 XRPL_ASSERT(
impl_,
"ripple::Rules::enabled : initialized");
130 if (feature == featureNonFungibleTokensV1 ||
131 feature == fixNFTokenNegOffer || feature == fixNFTokenDirV1)
133 if (
impl_->enabled(featureNonFungibleTokensV1_1))
137 return impl_->enabled(feature);
145 "ripple::Rules::operator==(Rules) const : both initialized");
154 return !(*
this == other);
std::unordered_set< uint256, hardened_hash<> > set_
Impl(std::unordered_set< uint256, beast::uhash<> > const &presets)
std::unordered_set< uint256, beast::uhash<> > const & presets() const
std::optional< uint256 > digest_
std::unordered_set< uint256, beast::uhash<> > const & presets_
bool enabled(uint256 const &feature) const
bool operator==(Impl const &other) const
Impl(std::unordered_set< uint256, beast::uhash<> > const &presets, std::optional< uint256 > const &digest, STVector256 const &amendments)
Rules controlling protocol behavior.
std::shared_ptr< Impl const > impl_
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
bool operator!=(Rules const &other) const
bool operator==(Rules const &) const
Returns true if two rule sets are identical.
std::unordered_set< uint256, beast::uhash<> > const & presets() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void setCurrentTransactionRules(std::optional< Rules > r)
static Hasher::result_type digest(void const *data, std::size_t size) noexcept
std::optional< Rules > const & getCurrentTransactionRules()