rippled
Loading...
Searching...
No Matches
Keylet.cpp
1#include <xrpl/beast/utility/instrumentation.h>
2#include <xrpl/protocol/Keylet.h>
3#include <xrpl/protocol/LedgerFormats.h>
4#include <xrpl/protocol/STLedgerEntry.h>
5
6namespace ripple {
7
8bool
9Keylet::check(STLedgerEntry const& sle) const
10{
11 XRPL_ASSERT(
12 sle.getType() != ltANY || sle.getType() != ltCHILD,
13 "ripple::Keylet::check : valid input type");
14
15 if (type == ltANY)
16 return true;
17
18 if (type == ltCHILD)
19 return sle.getType() != ltDIR_NODE;
20
21 return sle.getType() == type && sle.key() == key;
22}
23
24} // namespace ripple
LedgerEntryType getType() const
uint256 const & key() const
Returns the 'key' (or 'index') of this item.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ ltCHILD
A special type, matching any ledger type except directory nodes.
@ ltANY
A special type, matching any ledger entry type.
LedgerEntryType type
Definition Keylet.h:22
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
Definition Keylet.cpp:9
uint256 key
Definition Keylet.h:21