rippled
Loading...
Searching...
No Matches
xrpld
app
tx
detail
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
9
namespace
ripple
{
10
11
NotTEC
12
LedgerStateFix::preflight
(
PreflightContext
const
& ctx)
13
{
14
switch
(ctx.
tx
[sfLedgerFixType])
15
{
16
case
FixType::nfTokenPageLink
:
17
if
(!ctx.
tx
.
isFieldPresent
(sfOwner))
18
return
temINVALID
;
19
break
;
20
21
default
:
22
return
tefINVALID_LEDGER_FIX_TYPE
;
23
}
24
25
return
tesSUCCESS
;
26
}
27
28
XRPAmount
29
LedgerStateFix::calculateBaseFee
(
ReadView
const
& view,
STTx
const
& tx)
30
{
31
// The fee required for LedgerStateFix is one owner reserve, just like
32
// the fee for AccountDelete.
33
return
calculateOwnerReserveFee
(
view
, tx);
34
}
35
36
TER
37
LedgerStateFix::preclaim
(
PreclaimContext
const
& ctx)
38
{
39
switch
(ctx.
tx
[sfLedgerFixType])
40
{
41
case
FixType::nfTokenPageLink
: {
42
AccountID
const
owner{ctx.
tx
[sfOwner]};
43
if
(!ctx.
view
.
read
(
keylet::account
(owner)))
44
return
tecOBJECT_NOT_FOUND
;
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
54
TER
55
LedgerStateFix::doApply
()
56
{
57
switch
(
ctx_
.
tx
[sfLedgerFixType])
58
{
59
case
FixType::nfTokenPageLink
:
60
if
(!
nft::repairNFTokenDirectoryLinks
(
view
(),
ctx_
.
tx
[sfOwner]))
61
return
tecFAILED_PROCESSING
;
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
ripple::ApplyContext::tx
STTx const & tx
Definition
ApplyContext.h:53
ripple::LedgerStateFix::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition
LedgerStateFix.cpp:29
ripple::LedgerStateFix::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition
LedgerStateFix.cpp:12
ripple::LedgerStateFix::preclaim
static TER preclaim(PreclaimContext const &ctx)
Definition
LedgerStateFix.cpp:37
ripple::LedgerStateFix::doApply
TER doApply() override
Definition
LedgerStateFix.cpp:55
ripple::LedgerStateFix::nfTokenPageLink
@ nfTokenPageLink
Definition
LedgerStateFix.h:12
ripple::ReadView
A view into a ledger.
Definition
ReadView.h:32
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
ripple::STObject::isFieldPresent
bool isFieldPresent(SField const &field) const
Definition
STObject.cpp:465
ripple::STTx
Definition
STTx.h:29
ripple::TERSubset< CanCvtToTER >
ripple::Transactor::view
ApplyView & view()
Definition
Transactor.h:144
ripple::Transactor::calculateOwnerReserveFee
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
Definition
Transactor.cpp:293
ripple::Transactor::ctx_
ApplyContext & ctx_
Definition
Transactor.h:124
ripple::XRPAmount
Definition
XRPAmount.h:24
ripple::base_uint< 160, detail::AccountIDTag >
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition
Indexes.cpp:165
ripple::nft::repairNFTokenDirectoryLinks
bool repairNFTokenDirectoryLinks(ApplyView &view, AccountID const &owner)
Repairs the links in an NFTokenPage directory.
Definition
NFTokenUtils.cpp:683
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:6
ripple::tefINVALID_LEDGER_FIX_TYPE
@ tefINVALID_LEDGER_FIX_TYPE
Definition
TER.h:168
ripple::tecOBJECT_NOT_FOUND
@ tecOBJECT_NOT_FOUND
Definition
TER.h:308
ripple::tecINTERNAL
@ tecINTERNAL
Definition
TER.h:292
ripple::tecFAILED_PROCESSING
@ tecFAILED_PROCESSING
Definition
TER.h:268
ripple::tesSUCCESS
@ tesSUCCESS
Definition
TER.h:226
ripple::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition
TER.h:590
ripple::temINVALID
@ temINVALID
Definition
TER.h:91
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition
Transactor.h:61
ripple::PreclaimContext::view
ReadView const & view
Definition
Transactor.h:64
ripple::PreclaimContext::tx
STTx const & tx
Definition
Transactor.h:67
ripple::PreflightContext
State information when preflighting a tx.
Definition
Transactor.h:16
ripple::PreflightContext::tx
STTx const & tx
Definition
Transactor.h:19
Generated by
1.9.8