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 xrpl {
7
8bool
9Keylet::check(STLedgerEntry const& sle) const
10{
11 XRPL_ASSERT(sle.getType() != ltANY || sle.getType() != ltCHILD, "xrpl::Keylet::check : valid input type");
12
13 if (type == ltANY)
14 return true;
15
16 if (type == ltCHILD)
17 return sle.getType() != ltDIR_NODE;
18
19 return sle.getType() == type && sle.key() == key;
20}
21
22} // namespace xrpl
uint256 const & key() const
Returns the 'key' (or 'index') of this item.
LedgerEntryType getType() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ ltANY
A special type, matching any ledger entry type.
@ ltCHILD
A special type, matching any ledger type except directory nodes.
uint256 key
Definition Keylet.h:21
LedgerEntryType type
Definition Keylet.h:22
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
Definition Keylet.cpp:9