-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
489 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
//------------------------------------------------------------------------------ | ||
/* | ||
This file is part of rippled: https://github.com/ripple/rippled | ||
Copyright (c) 2012, 2013 Ripple Labs Inc. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
*/ | ||
//============================================================================== | ||
|
||
#ifndef RIPPLE_LEDGER_RULES_H_INCLUDED | ||
#define RIPPLE_LEDGER_RULES_H_INCLUDED | ||
|
||
#include <ripple/basics/base_uint.h> | ||
#include <ripple/beast/hash/uhash.h> | ||
#include <unordered_set> | ||
|
||
namespace ripple { | ||
|
||
class DigestAwareReadView; | ||
|
||
/** Rules controlling protocol behavior. */ | ||
class Rules | ||
{ | ||
private: | ||
class Impl; | ||
|
||
std::shared_ptr<Impl const> impl_; | ||
|
||
public: | ||
Rules(Rules const&) = default; | ||
Rules& | ||
operator=(Rules const&) = default; | ||
|
||
Rules() = delete; | ||
|
||
/** Construct an empty rule set. | ||
These are the rules reflected by | ||
the genesis ledger. | ||
*/ | ||
explicit Rules(std::unordered_set<uint256, beast::uhash<>> const& presets); | ||
|
||
/** Construct rules from a ledger. | ||
The ledger contents are analyzed for rules | ||
and amendments and extracted to the object. | ||
*/ | ||
explicit Rules( | ||
DigestAwareReadView const& ledger, | ||
std::unordered_set<uint256, beast::uhash<>> const& presets); | ||
|
||
/** Returns `true` if a feature is enabled. */ | ||
bool | ||
enabled(uint256 const& id) const; | ||
|
||
/** Returns `true` if these rules don't match the ledger. */ | ||
bool | ||
changed(DigestAwareReadView const& ledger) const; | ||
|
||
/** Returns `true` if two rule sets are identical. | ||
@note This is for diagnostics. To determine if new | ||
rules should be constructed, call changed() first instead. | ||
*/ | ||
bool | ||
operator==(Rules const&) const; | ||
|
||
bool | ||
operator!=(Rules const& other) const; | ||
}; | ||
|
||
} // namespace ripple | ||
#endif |
Oops, something went wrong.