1#include <xrpl/tx/transactors/credentials/CredentialDelete.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/ledger/ApplyView.h>
5#include <xrpl/ledger/helpers/CredentialHelpers.h>
6#include <xrpl/protocol/AccountID.h>
7#include <xrpl/protocol/Feature.h>
8#include <xrpl/protocol/Indexes.h>
9#include <xrpl/protocol/Protocol.h>
10#include <xrpl/protocol/SField.h>
11#include <xrpl/protocol/STLedgerEntry.h>
12#include <xrpl/protocol/STTx.h>
13#include <xrpl/protocol/TER.h>
14#include <xrpl/protocol/TxFlags.h>
15#include <xrpl/protocol/XRPAmount.h>
16#include <xrpl/tx/Transactor.h>
33 auto const subject = ctx.
tx[~sfSubject];
34 auto const issuer = ctx.
tx[~sfIssuer];
36 if (!subject && !issuer)
39 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: "
40 "No Subject or Issuer fields.";
45 if ((subject && subject->isZero()) || (issuer && issuer->isZero()))
47 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: Subject or Issuer "
52 auto const credType = ctx.
tx[sfCredentialType];
55 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: invalid size of CredentialType.";
66 auto const subject = ctx.
tx[~sfSubject].value_or(account);
67 auto const issuer = ctx.
tx[~sfIssuer].value_or(account);
68 auto const credType(ctx.
tx[sfCredentialType]);
82 auto const credType(
ctx_.tx[sfCredentialType]);
90 JLOG(
j_.trace()) <<
"Can't delete non-expired credential.";
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
virtual SLE::pointer peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
static TER preclaim(PreclaimContext const &ctx)
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
bool finalizeInvariants(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j) override
Check transaction-specific post-conditions after all entries have been visited.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::shared_ptr< STLedgerEntry const > const & const_ref
AccountID const accountID_
TER deleteSLE(ApplyView &view, SLE::ref sleCredential, beast::Journal j)
bool checkExpired(SLE const &sleCredential, NetClock::time_point const &closed)
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::size_t kMaxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
TERSubset< CanCvtToNotTEC > NotTEC
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
TERSubset< CanCvtToTER > TER
constexpr FlagValue tfUniversalMask
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.