xrpld
Loading...
Searching...
No Matches
Keylet.cpp
1#include <xrpl/protocol/Keylet.h>
2
3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/protocol/LedgerFormats.h>
5#include <xrpl/protocol/STLedgerEntry.h>
6
7namespace xrpl {
8
9bool
11{
12 XRPL_ASSERT(
13 sle.getType() != ltANY && sle.getType() != ltCHILD,
14 "xrpl::Keylet::check : valid input type");
15
16 if (type == ltANY)
17 return true;
18
19 if (type == ltCHILD)
20 return sle.getType() != ltDIR_NODE;
21
22 return sle.getType() == type && sle.key() == key;
23}
24
25} // 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:5
@ 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:20
LedgerEntryType type
Definition Keylet.h:21
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
Definition Keylet.cpp:10