xrpld
Loading...
Searching...
No Matches
Indexes.cpp
1#include <xrpl/protocol/Indexes.h>
2
3#include <xrpl/basics/Slice.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/basics/safe_cast.h>
6#include <xrpl/beast/utility/instrumentation.h>
7#include <xrpl/protocol/AccountID.h>
8#include <xrpl/protocol/Asset.h>
9#include <xrpl/protocol/Book.h>
10#include <xrpl/protocol/Concepts.h>
11#include <xrpl/protocol/Issue.h>
12#include <xrpl/protocol/LedgerFormats.h>
13#include <xrpl/protocol/MPTIssue.h>
14#include <xrpl/protocol/Protocol.h>
15#include <xrpl/protocol/SField.h>
16#include <xrpl/protocol/STXChainBridge.h>
17#include <xrpl/protocol/SeqProxy.h>
18#include <xrpl/protocol/UintTypes.h>
19#include <xrpl/protocol/digest.h>
20#include <xrpl/protocol/jss.h>
21#include <xrpl/protocol/nftPageMask.h>
22
23#include <boost/endian/conversion.hpp>
24
25#include <algorithm>
26#include <array>
27#include <cstdint>
28#include <cstring>
29#include <set>
30#include <utility>
31#include <variant>
32#include <vector>
33
34namespace xrpl {
35
36// This list should include all of the keylet functions that take a single
37// AccountID parameter. Declared in Indexes.h; defined here so the header need
38// not include jss.h.
40 {{.function = &keylet::account, .expectedLEName = jss::AccountRoot, .includeInTests = false},
41 {.function = &keylet::ownerDir, .expectedLEName = jss::DirectoryNode, .includeInTests = true},
42 {.function = &keylet::signerList, .expectedLEName = jss::SignerList, .includeInTests = true},
43 // It's normally impossible to create an item at nftpage_min, but
44 // test it anyway, since the invariant checks for it.
45 {.function = &keylet::nftokenPageMin,
46 .expectedLEName = jss::NFTokenPage,
47 .includeInTests = true},
48 {.function = &keylet::nftokenPageMax,
49 .expectedLEName = jss::NFTokenPage,
50 .includeInTests = true},
51 {.function = &keylet::did, .expectedLEName = jss::DID, .includeInTests = true}}};
52
72 Account = 'a',
73 DirNode = 'd',
74 TrustLine = 'r',
75 Offer = 'o',
76 OwnerDir = 'O',
77 BookDir = 'B',
78 SkipList = 's',
79 Escrow = 'u',
82 Ticket = 'T',
85 Check = 'C',
92 Amm = 'A',
93 Bridge = 'H',
96 Did = 'I',
97 Oracle = 'R',
99 MPToken = 't',
102 Delegate = 'E',
103 Vault = 'V',
104 LoanBroker = 'l', // lower-case L
105 Loan = 'L',
108
109 // No longer used or supported. Left here to reserve the space to avoid accidental reuse.
110 Contract [[deprecated]] = 'c',
111 Generator [[deprecated]] = 'g',
112 Nickname [[deprecated]] = 'n',
113};
114
115template <class... Args>
116static UInt256
117indexHash(LedgerNameSpace space, Args const&... args)
118{
119 return sha512Half(safeCast<std::uint16_t>(space), args...);
120}
121
123getBookBase(Book const& book)
124{
125 XRPL_ASSERT(isConsistent(book), "xrpl::getBookBase : input is consistent");
126
127 constexpr std::uint8_t kIssueToMPTTag = 0x01;
128 constexpr std::uint8_t kMPTToIssueTag = 0x02;
129 constexpr std::uint8_t kMPTToMPTTag = 0x03;
130
131 auto getIndexHash = [&book]<typename... Args>(Args... args) {
132 if (book.domain)
133 return indexHash(std::forward<Args>(args)..., *book.domain);
134 return indexHash(std::forward<Args>(args)...);
135 };
136
137 auto const index = std::visit(
138 [&]<ValidIssueType TIn, ValidIssueType TOut>(TIn const& in, TOut const& out) {
140 {
141 return getIndexHash(
142 LedgerNameSpace::BookDir, in.currency, out.currency, in.account, out.account);
143 }
144 // The three MPT-involving branches are new under MPTokensV2 and
145 // each gets a 1-byte discriminator to prevent preimage collisions
146 // between branches: the (Issue,MPT) and (MPT,Issue) preimages
147 // are both 64 bytes of raw concatenation, so without a
148 // per-branch tag chosen Currency / MPTID / AccountID values can
149 // align byte-for-byte and produce the same BookDir keylet for
150 // two distinct markets. (Issue,Issue) is left untagged to
151 // preserve existing mainnet order-book keylets.
153 {
154 return getIndexHash(
156 kIssueToMPTTag,
157 in.currency,
158 out.getMptID(),
159 in.account);
160 }
162 {
163 return getIndexHash(
165 kMPTToIssueTag,
166 in.getMptID(),
167 out.currency,
168 out.account);
169 }
170 else
171 {
172 return getIndexHash(
173 LedgerNameSpace::BookDir, kMPTToMPTTag, in.getMptID(), out.getMptID());
174 }
175 },
176 book.in.value(),
177 book.out.value());
178
179 // Return with quality 0.
180 auto k = keylet::quality({ltDIR_NODE, index}, 0);
181
182 return k.key;
183}
184
187{
188 static constexpr UInt256 kNextQuality(
189 "0000000000000000000000000000000000000000000000010000000000000000");
190 return uBase + kNextQuality;
191}
192
194getQuality(UInt256 const& uBase)
195{
196 // VFALCO [base_uint] This assumes a certain storage format
197 //
198 // Load the final 8 bytes as a big-endian integer. load_big_u64 reads
199 // through unaligned byte storage (via memcpy) and applies the endian
200 // conversion, avoiding the alignment/strict-aliasing UB of casting the
201 // unsigned char* returned by end() to a std::uint64_t*.
202 return boost::endian::load_big_u64(uBase.end() - 8);
203}
204
205MPTID
206makeMptID(std::uint32_t const sequence, AccountID const& account)
207{
208 MPTID u;
209 auto const bigEndianSequence = boost::endian::native_to_big(sequence);
210 memcpy(u.data(), &bigEndianSequence, sizeof(bigEndianSequence));
211 memcpy(u.data() + sizeof(bigEndianSequence), account.data(), sizeof(account));
212 return u;
213}
214
215//------------------------------------------------------------------------------
216
217namespace keylet {
218
219Keylet
220account(AccountID const& id) noexcept
221{
222 return Keylet{ltACCOUNT_ROOT, indexHash(LedgerNameSpace::Account, id)};
223}
224
225Keylet
226child(UInt256 const& key) noexcept
227{
228 return {ltCHILD, key};
229}
230
231Keylet const&
232skip() noexcept
233{
234 static Keylet const kRet{ltLEDGER_HASHES, indexHash(LedgerNameSpace::SkipList)};
235 return kRet;
236}
237
238Keylet
239skip(LedgerIndex ledger) noexcept
240{
241 return {
242 ltLEDGER_HASHES,
243 indexHash(
244 LedgerNameSpace::SkipList, std::uint32_t(static_cast<std::uint32_t>(ledger) >> 16))};
245}
246
247Keylet const&
248amendments() noexcept
249{
250 static Keylet const kRet{ltAMENDMENTS, indexHash(LedgerNameSpace::Amendments)};
251 return kRet;
252}
253
254Keylet const&
255feeSettings() noexcept
256{
257 static Keylet const kRet{ltFEE_SETTINGS, indexHash(LedgerNameSpace::FeeSettings)};
258 return kRet;
259}
260
261Keylet const&
262negativeUNL() noexcept
263{
264 static Keylet const kRet{ltNEGATIVE_UNL, indexHash(LedgerNameSpace::NegativeUnl)};
265 return kRet;
266}
267
268Keylet
269book(Book const& b)
270{
271 return {ltDIR_NODE, getBookBase(b)};
272}
273
274Keylet
275trustLine(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept
276{
277 // There is code in TrustSet that calls us with id0 == id1, to allow users
278 // to locate and delete such "weird" trustlines. If we remove that code, we
279 // could enable this assert:
280 // XRPL_ASSERT(id0 != id1, "xrpl::keylet::trustLine : accounts must be
281 // different");
282
283 // A trust line is shared between two accounts; while we typically think
284 // of this as an "issuer" and a "holder" the relationship is actually fully
285 // bidirectional.
286 //
287 // So that we can generate a unique ID for a trust line, regardess of which
288 // side of the line we're looking at, we define a "canonical" order for the
289 // two accounts (smallest then largest) and hash them in that order:
290 auto const accounts = std::minmax(id0, id1);
291
292 return {
293 ltRIPPLE_STATE,
294 indexHash(LedgerNameSpace::TrustLine, accounts.first, accounts.second, currency)};
295}
296
297Keylet
298offer(AccountID const& id, SeqProxy const& seq) noexcept
299{
300 return {ltOFFER, indexHash(LedgerNameSpace::Offer, id, seq.value())};
301}
302
303Keylet
304quality(Keylet const& k, std::uint64_t const q) noexcept
305{
306 XRPL_ASSERT(k.type == ltDIR_NODE, "xrpl::keylet::quality : valid input type");
307
308 // Indexes are stored in big endian format: they print as hex as stored.
309 // Most significant bytes are first and the least significant bytes
310 // represent adjacent entries. We place the quality, in big endian format,
311 // in the 8 right most bytes; this way, incrementing goes to the next entry
312 // for indexes.
313 UInt256 x = k.key;
314
315 // Store the quality as a big-endian integer in the final 8 bytes.
316 // store_big_u64 writes through unaligned byte storage (via memcpy) and
317 // applies the endian conversion, avoiding the alignment/strict-aliasing UB
318 // of casting the unsigned char* returned by end() to a std::uint64_t*.
319 boost::endian::store_big_u64(x.end() - 8, q);
320
321 return {ltDIR_NODE, x};
322}
323
324Keylet
325next(Keylet const& k)
326{
327 XRPL_ASSERT(k.type == ltDIR_NODE, "xrpl::keylet::next : valid input type");
328 return {ltDIR_NODE, getQualityNext(k.key)};
329}
330
331Keylet
332ticket(AccountID const& id, SeqProxy const& seq)
333{
334 XRPL_ASSERT(seq.isTicket(), "xrpl::keylet::ticket : valid input");
335 return {ltTICKET, indexHash(LedgerNameSpace::Ticket, id, seq.value())};
336}
337
338// This function is presently static, since it's never accessed from anywhere
339// else. If we ever support multiple pages of signer lists, this would be the
340// keylet used to locate them.
341static Keylet
343{
344 return {ltSIGNER_LIST, indexHash(LedgerNameSpace::SignerList, account, page)};
345}
346
347Keylet
349{
350 return signerList(account, 0);
351}
352
353Keylet
354sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept
355{
356 return {ltSPONSORSHIP, indexHash(LedgerNameSpace::Sponsorship, sponsor, sponsee)};
357}
358
359Keylet
360check(AccountID const& id, SeqProxy const& seq) noexcept
361{
362 return {ltCHECK, indexHash(LedgerNameSpace::Check, id, seq.value())};
363}
364
365Keylet
366txProposal(AccountID const& target, std::uint32_t ticketSequence) noexcept
367{
368 return {
369 ltTRANSACTION_PROPOSAL,
370 indexHash(LedgerNameSpace::TransactionProposal, target, ticketSequence)};
371}
372
373Keylet
374depositPreauth(AccountID const& owner, AccountID const& preauthorized) noexcept
375{
376 return {ltDEPOSIT_PREAUTH, indexHash(LedgerNameSpace::DepositPreauth, owner, preauthorized)};
377}
378
379// Credentials should be sorted here, use credentials::makeSorted
380Keylet
382 AccountID const& owner,
383 std::set<std::pair<AccountID, Slice>> const& authCreds) noexcept
384{
386 hashes.reserve(authCreds.size());
387 for (auto const& o : authCreds)
388 hashes.emplace_back(sha512Half(o.first, o.second));
389
390 return {
391 ltDEPOSIT_PREAUTH, indexHash(LedgerNameSpace::DepositPreauthCredentials, owner, hashes)};
392}
393
394//------------------------------------------------------------------------------
395
396Keylet
397unchecked(UInt256 const& key) noexcept
398{
399 return {ltANY, key};
400}
401
402Keylet
403ownerDir(AccountID const& id) noexcept
404{
405 return {ltDIR_NODE, indexHash(LedgerNameSpace::OwnerDir, id)};
406}
407
408Keylet
409page(UInt256 const& key, std::uint64_t const index) noexcept
410{
411 if (index == 0)
412 return {ltDIR_NODE, key};
413
414 return {ltDIR_NODE, indexHash(LedgerNameSpace::DirNode, key, index)};
415}
416
417Keylet
418escrow(AccountID const& src, SeqProxy const& seq) noexcept
419{
420 return {ltESCROW, indexHash(LedgerNameSpace::Escrow, src, seq.value())};
421}
422
423Keylet
424payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept
425{
426 return {ltPAYCHAN, indexHash(LedgerNameSpace::XRPPaymentChannel, src, dst, seq.value())};
427}
428
429Keylet
431{
433 std::memcpy(buf.data(), owner.data(), owner.size());
434 return {ltNFTOKEN_PAGE, UInt256::fromRaw(buf)};
435}
436
437Keylet
439{
441 std::memcpy(id.data(), owner.data(), owner.size());
442 return {ltNFTOKEN_PAGE, id};
443}
444
445Keylet
446nftokenPage(Keylet const& k, UInt256 const& token)
447{
448 XRPL_ASSERT(k.type == ltNFTOKEN_PAGE, "xrpl::keylet::nftokenPage : valid input type");
449 return {ltNFTOKEN_PAGE, (k.key & ~nft::kPageMask) + (token & nft::kPageMask)};
450}
451
452Keylet
453nftokenOffer(AccountID const& owner, SeqProxy const& seq)
454{
455 return {ltNFTOKEN_OFFER, indexHash(LedgerNameSpace::NftokenOffer, owner, seq.value())};
456}
457
458Keylet
459nftBuys(UInt256 const& id) noexcept
460{
461 return {ltDIR_NODE, indexHash(LedgerNameSpace::NftokenBuyOffers, id)};
462}
463
464Keylet
465nftSells(UInt256 const& id) noexcept
466{
467 return {ltDIR_NODE, indexHash(LedgerNameSpace::NftokenSellOffers, id)};
468}
469
470Keylet
471amm(Asset const& asset1, Asset const& asset2) noexcept
472{
473 auto const& [minA, maxA] = std::minmax(asset1, asset2);
474 return std::visit(
475 []<ValidIssueType TIss1, ValidIssueType TIss2>(TIss1 const& issue1, TIss2 const& issue2) {
477 {
478 return amm(indexHash(
480 issue1.account,
481 issue1.currency,
482 issue2.account,
483 issue2.currency));
484 }
486 {
487 return amm(indexHash(
488 LedgerNameSpace::Amm, issue1.account, issue1.currency, issue2.getMptID()));
489 }
491 {
492 return amm(indexHash(
493 LedgerNameSpace::Amm, issue1.getMptID(), issue2.account, issue2.currency));
494 }
496 {
497 return amm(indexHash(LedgerNameSpace::Amm, issue1.getMptID(), issue2.getMptID()));
498 }
499 },
500 minA.value(),
501 maxA.value());
502}
503
504Keylet
505amm(UInt256 const& id) noexcept
506{
507 return {ltAMM, id};
508}
509
510Keylet
511delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept
512{
513 return {ltDELEGATE, indexHash(LedgerNameSpace::Delegate, account, authorizedAccount)};
514}
515
516Keylet
518{
519 // A door account can support multiple bridges. On the locking chain
520 // there can only be one bridge per lockingChainCurrency. On the issuing
521 // chain there can only be one bridge per issuingChainCurrency.
522 auto const& issue = bridge.issue(chainType);
523 return {ltBRIDGE, indexHash(LedgerNameSpace::Bridge, bridge.door(chainType), issue.currency)};
524}
525
526Keylet
528{
529 return {
530 ltXCHAIN_OWNED_CLAIM_ID,
531 indexHash(
533 bridge.lockingChainDoor(),
534 bridge.lockingChainIssue(),
535 bridge.issuingChainDoor(),
536 bridge.issuingChainIssue(),
537 seq)};
538}
539
540Keylet
542{
543 return {
544 ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID,
545 indexHash(
547 bridge.lockingChainDoor(),
548 bridge.lockingChainIssue(),
549 bridge.issuingChainDoor(),
550 bridge.issuingChainIssue(),
551 seq)};
552}
553
554Keylet
555did(AccountID const& account) noexcept
556{
557 return {ltDID, indexHash(LedgerNameSpace::Did, account)};
558}
559
560Keylet
561oracle(AccountID const& account, std::uint32_t const documentID) noexcept
562{
563 return {ltORACLE, indexHash(LedgerNameSpace::Oracle, account, documentID)};
564}
565
566Keylet
567mptokenIssuance(MPTID const& issuanceID) noexcept
568{
569 return {ltMPTOKEN_ISSUANCE, indexHash(LedgerNameSpace::MPTokenIssuance, issuanceID)};
570}
571
572Keylet
573mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept
574{
575 return mptoken(mptokenIssuance(issuanceID).key, holder);
576}
577
578Keylet
579mptoken(UInt256 const& issuanceKey, AccountID const& holder) noexcept
580{
581 return {ltMPTOKEN, indexHash(LedgerNameSpace::MPToken, issuanceKey, holder)};
582}
583
584Keylet
585credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept
586{
587 return {ltCREDENTIAL, indexHash(LedgerNameSpace::Credential, subject, issuer, credType)};
588}
589
590Keylet
591vault(AccountID const& owner, SeqProxy const& seq) noexcept
592{
593 return vault(indexHash(LedgerNameSpace::Vault, owner, seq.value()));
594}
595
596Keylet
597loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept
598{
599 return loanBroker(indexHash(LedgerNameSpace::LoanBroker, owner, seq.value()));
600}
601
602Keylet
603loan(UInt256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept
604{
605 return loan(indexHash(LedgerNameSpace::Loan, loanBrokerID, loanSeq.value()));
606}
607
608Keylet
609permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept
610{
611 return {
612 ltPERMISSIONED_DOMAIN,
614}
615
616Keylet
617permissionedDomain(UInt256 const& domainID) noexcept
618{
619 return {ltPERMISSIONED_DOMAIN, domainID};
620}
621
622} // namespace keylet
623
624} // namespace xrpl
static BaseUInt fromRaw(Container const &c)
Definition base_uint.h:302
iterator end()
Definition base_uint.h:133
pointer data()
Definition base_uint.h:117
static constexpr std::size_t size()
Definition base_uint.h:548
Specifies an order book.
Definition Book.h:28
A type that represents either a sequence value or a ticket value.
Definition SeqProxy.h:37
constexpr bool isTicket() const
Definition SeqProxy.h:92
constexpr std::uint32_t value() const
Definition SeqProxy.h:80
An immutable linear range of bytes.
Definition Slice.h:28
T data(T... args)
T emplace_back(T... args)
T forward(T... args)
T is_same_v
T memcpy(T... args)
T minmax(T... args)
Keylet const & skip() noexcept
The index of the "short" skip list.
Definition Indexes.cpp:232
Keylet nftokenOffer(AccountID const &owner, SeqProxy const &seq)
An offer from an account to buy or sell an NFT.
Definition Indexes.cpp:453
Keylet oracle(AccountID const &account, std::uint32_t const documentID) noexcept
Definition Indexes.cpp:561
Keylet next(Keylet const &k)
The directory for the next lower quality.
Definition Indexes.cpp:325
Keylet payChannel(AccountID const &src, AccountID const &dst, SeqProxy const &seq) noexcept
A PaymentChannel.
Definition Indexes.cpp:424
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
Definition Indexes.cpp:262
Keylet escrow(AccountID const &src, SeqProxy const &seq) noexcept
An escrow entry.
Definition Indexes.cpp:418
Keylet did(AccountID const &account) noexcept
Definition Indexes.cpp:555
Keylet quality(Keylet const &k, std::uint64_t const q) noexcept
The initial directory page for a specific quality.
Definition Indexes.cpp:304
Keylet offer(AccountID const &id, SeqProxy const &seq) noexcept
An offer from an account.
Definition Indexes.cpp:298
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition Indexes.cpp:374
Keylet nftokenPage(Keylet const &k, UInt256 const &token)
Definition Indexes.cpp:446
Keylet book(Book const &b)
The beginning of an order book.
Definition Indexes.cpp:269
Keylet bridge(STXChainBridge const &bridge, STXChainBridge::ChainType chainType)
Definition Indexes.cpp:517
Keylet const & feeSettings() noexcept
The (fixed) index of the object containing the ledger fees.
Definition Indexes.cpp:255
Keylet const & amendments() noexcept
The index of the amendment table.
Definition Indexes.cpp:248
Keylet signerList(AccountID const &account) noexcept
A SignerList.
Definition Indexes.cpp:348
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition Indexes.cpp:403
Keylet txProposal(AccountID const &target, std::uint32_t ticketSequence) noexcept
A TransactionProposal.
Definition Indexes.cpp:366
Keylet check(AccountID const &id, SeqProxy const &seq) noexcept
A Check.
Definition Indexes.cpp:360
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Definition Indexes.cpp:471
Keylet nftokenPageMin(AccountID const &owner)
NFT page keylets.
Definition Indexes.cpp:430
Keylet unchecked(UInt256 const &key) noexcept
Any ledger entry.
Definition Indexes.cpp:397
Keylet ticket(AccountID const &id, SeqProxy const &ticketSeq)
A ticket belonging to an account.
Definition Indexes.cpp:332
Keylet vault(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:591
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:609
Keylet nftokenPageMax(AccountID const &owner)
A keylet for the owner's last possible NFT page.
Definition Indexes.cpp:438
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition Indexes.cpp:409
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Definition Indexes.cpp:573
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Definition Indexes.cpp:511
Keylet loanBroker(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:597
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition Indexes.cpp:220
Keylet xChainClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:527
Keylet sponsorship(AccountID const &sponsor, AccountID const &sponsee) noexcept
A Sponsorship.
Definition Indexes.cpp:354
Keylet nftSells(UInt256 const &id) noexcept
The directory of sell offers for the specified NFT.
Definition Indexes.cpp:465
Keylet nftBuys(UInt256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition Indexes.cpp:459
Keylet loan(UInt256 const &loanBrokerID, SeqProxy const &loanSeq) noexcept
Definition Indexes.cpp:603
Keylet xChainCreateAccountClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:541
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Definition Indexes.cpp:585
Keylet child(UInt256 const &key) noexcept
Any item that can be in an owner dir.
Definition Indexes.cpp:226
Keylet mptokenIssuance(MPTID const &issuanceID) noexcept
Definition Indexes.cpp:567
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition Indexes.cpp:275
constexpr UInt256 kPageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
UInt256 getBookBase(Book const &book)
Definition Indexes.cpp:123
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:382
std::uint64_t getQuality(UInt256 const &uBase)
Definition Indexes.cpp:194
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:42
UInt256 getQualityNext(UInt256 const &uBase)
Definition Indexes.cpp:186
constexpr Dest safeCast(Src s) noexcept
Definition safe_cast.h:21
static UInt256 indexHash(LedgerNameSpace space, Args const &... args)
Definition Indexes.cpp:117
BaseUInt< 256 > UInt256
Definition base_uint.h:580
BaseUInt< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition UintTypes.h:54
LedgerNameSpace
Type-specific prefix for calculating ledger indices.
Definition Indexes.cpp:71
MPTID makeMptID(std::uint32_t const sequence, AccountID const &account)
Definition Indexes.cpp:206
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34
bool isConsistent(Asset const &asset)
Definition Asset.h:323
@ ltANY
A special type, matching any ledger entry type.
@ ltCHILD
A special type, matching any ledger type except directory nodes.
std::array< KeyletDesc< AccountID const & >, 6 > const kDirectAccountKeylets
Definition Indexes.cpp:39
Sha512HalfHasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition digest.h:215
T reserve(T... args)
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20
UInt256 key
Definition Keylet.h:21
LedgerEntryType type
Definition Keylet.h:22
T visit(T... args)