rippled
Loading...
Searching...
No Matches
LedgerStateFix.cpp
1#include <xrpld/app/tx/detail/LedgerStateFix.h>
2#include <xrpld/app/tx/detail/NFTokenUtils.h>
3
4#include <xrpl/ledger/View.h>
5#include <xrpl/protocol/Feature.h>
6#include <xrpl/protocol/Indexes.h>
7#include <xrpl/protocol/TxFlags.h>
8
9namespace ripple {
10
13{
14 switch (ctx.tx[sfLedgerFixType])
15 {
17 if (!ctx.tx.isFieldPresent(sfOwner))
18 return temINVALID;
19 break;
20
21 default:
23 }
24
25 return tesSUCCESS;
26}
27
30{
31 // The fee required for LedgerStateFix is one owner reserve, just like
32 // the fee for AccountDelete.
34}
35
36TER
38{
39 switch (ctx.tx[sfLedgerFixType])
40 {
42 AccountID const owner{ctx.tx[sfOwner]};
43 if (!ctx.view.read(keylet::account(owner)))
45
46 return tesSUCCESS;
47 }
48 }
49
50 // preflight is supposed to verify that only valid FixTypes get to preclaim.
51 return tecINTERNAL; // LCOV_EXCL_LINE
52}
53
54TER
56{
57 switch (ctx_.tx[sfLedgerFixType])
58 {
62
63 return tesSUCCESS;
64 }
65
66 // preflight is supposed to verify that only valid FixTypes get to doApply.
67 return tecINTERNAL; // LCOV_EXCL_LINE
68}
69
70} // namespace ripple
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:32
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:465
ApplyView & view()
Definition Transactor.h:144
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
ApplyContext & ctx_
Definition Transactor.h:124
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:6
@ tefINVALID_LEDGER_FIX_TYPE
Definition TER.h:168
@ tecOBJECT_NOT_FOUND
Definition TER.h:308
@ tecINTERNAL
Definition TER.h:292
@ tecFAILED_PROCESSING
Definition TER.h:268
@ tesSUCCESS
Definition TER.h:226
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:590
@ temINVALID
Definition TER.h:91
State information when determining if a tx is likely to claim a fee.
Definition Transactor.h:61
ReadView const & view
Definition Transactor.h:64
State information when preflighting a tx.
Definition Transactor.h:16