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