rippled
Loading...
Searching...
No Matches
LedgerStateFix.cpp
1#include <xrpl/ledger/View.h>
2#include <xrpl/protocol/Feature.h>
3#include <xrpl/protocol/Indexes.h>
4#include <xrpl/protocol/TxFlags.h>
5#include <xrpl/tx/transactors/nft/NFTokenUtils.h>
6#include <xrpl/tx/transactors/system/LedgerStateFix.h>
7
8namespace xrpl {
9
12{
13 switch (ctx.tx[sfLedgerFixType])
14 {
16 if (!ctx.tx.isFieldPresent(sfOwner))
17 return temINVALID;
18 break;
19
20 default:
22 }
23
24 return tesSUCCESS;
25}
26
29{
30 // The fee required for LedgerStateFix is one owner reserve, just like
31 // the fee for AccountDelete.
33}
34
35TER
37{
38 if (ctx.tx[sfLedgerFixType] == FixType::nfTokenPageLink)
39 {
40 AccountID const owner{ctx.tx[sfOwner]};
41 if (!ctx.view.read(keylet::account(owner)))
43
44 return tesSUCCESS;
45 }
46
47 // preflight is supposed to verify that only valid FixTypes get to preclaim.
48 return tecINTERNAL; // LCOV_EXCL_LINE
49}
50
51TER
53{
54 if (ctx_.tx[sfLedgerFixType] == FixType::nfTokenPageLink)
55 {
58
59 return tesSUCCESS;
60 }
61
62 // preflight is supposed to verify that only valid FixTypes get to doApply.
63 return tecINTERNAL; // LCOV_EXCL_LINE
64}
65
66} // namespace xrpl
STTx const & tx
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
A view into a ledger.
Definition ReadView.h:31
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:456
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
ApplyView & view()
Definition Transactor.h:132
ApplyContext & ctx_
Definition Transactor.h:112
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition Indexes.cpp:165
bool repairNFTokenDirectoryLinks(ApplyView &view, AccountID const &owner)
Repairs the links in an NFTokenPage directory.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
@ tefINVALID_LEDGER_FIX_TYPE
Definition TER.h:167
@ temINVALID
Definition TER.h:90
@ tecOBJECT_NOT_FOUND
Definition TER.h:307
@ tecINTERNAL
Definition TER.h:291
@ tecFAILED_PROCESSING
Definition TER.h:267
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:582
@ tesSUCCESS
Definition TER.h:225
State information when determining if a tx is likely to claim a fee.
Definition Transactor.h:57
ReadView const & view
Definition Transactor.h:60
State information when preflighting a tx.
Definition Transactor.h:14