20 #include <ripple/app/ledger/Ledger.h>
21 #include <ripple/app/tx/impl/CreateCheck.h>
22 #include <ripple/basics/Log.h>
23 #include <ripple/protocol/Feature.h>
24 #include <ripple/protocol/Indexes.h>
25 #include <ripple/protocol/STAccount.h>
26 #include <ripple/protocol/TER.h>
27 #include <ripple/protocol/TxFlags.h>
44 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: Invalid flags set.";
50 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: Check to self.";
56 if (!
isLegalNet(sendMax) || sendMax.signum() <= 0)
58 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: bad sendMax amount: "
59 << sendMax.getFullText();
65 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: Bad currency.";
74 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: bad expiration";
89 JLOG(ctx.
j.
warn()) <<
"Destination account does not exist.";
93 auto const flags = sleDst->getFlags();
104 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: DestinationTag required.";
110 if (!sendMax.native())
113 AccountID const& issuerId{sendMax.getIssuer()};
116 JLOG(ctx.
j.
warn()) <<
"Creating a check for frozen asset";
125 if (issuerId != srcId)
128 auto const sleTrust = ctx.
view.
read(
135 <<
"Creating a check for frozen trustline.";
139 if (issuerId != dstId)
142 auto const sleTrust = ctx.
view.
read(
149 <<
"Creating a check for destination frozen trustline.";
157 JLOG(ctx.
j.
warn()) <<
"Creating a check that has already expired.";
185 auto sleCheck = std::make_shared<SLE>(checkKeylet);
213 JLOG(
j_.
trace()) <<
"Adding Check to destination directory "
215 << (page ?
"success" :
"failure");
229 JLOG(
j_.
trace()) <<
"Adding Check to owner directory "
231 << (page ?
"success" :
"failure");
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
const SF_UINT32 sfOwnerCount
void setAccountID(SField const &field, AccountID const &)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
const SF_UINT32 sfSourceTag
A pair of SHAMap key and LedgerEntryType.
const SF_AMOUNT sfSendMax
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
const SF_UINT64 sfOwnerNode
Stream trace() const
Severity stream access functions.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const SF_ACCOUNT sfDestination
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
const SF_UINT32 sfSequence
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
SeqProxy getSeqProxy() const
bool isLegalNet(STAmount const &value)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
const SF_UINT32 sfExpiration
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
static TER preclaim(PreclaimContext const &ctx)
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
Keylet account(AccountID const &id) noexcept
AccountID root.
const uint256 featureDisallowIncoming
AccountID getAccountID(SField const &field) const
const SF_UINT64 sfDestinationNode
std::uint32_t getFlags() const
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
const uint256 featureChecks
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
State information when determining if a tx is likely to claim a fee.
constexpr std::uint32_t value() const
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual beast::Journal journal(std::string const &name)=0
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
const SF_UINT256 sfInvoiceID
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool isFieldPresent(SField const &field) const
const SF_UINT32 sfDestinationTag
@ lsfDisallowIncomingCheck
@ tecINSUFFICIENT_RESERVE
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_ACCOUNT sfAccount
State information when preflighting a tx.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
Keylet check(AccountID const &id, std::uint32_t seq) noexcept
A Check.
static NotTEC preflight(PreflightContext const &ctx)
constexpr std::uint32_t tfUniversalMask
STAmount const & getFieldAmount(SField const &field) const
TERSubset< CanCvtToNotTEC > NotTEC