1#include <xrpl/basics/Log.h>
2#include <xrpl/ledger/ApplyView.h>
3#include <xrpl/ledger/View.h>
4#include <xrpl/ledger/helpers/CredentialHelpers.h>
5#include <xrpl/protocol/Feature.h>
6#include <xrpl/protocol/Indexes.h>
7#include <xrpl/protocol/TxFlags.h>
8#include <xrpl/tx/transactors/credentials/CredentialDelete.h>
14using namespace credentials;
26 auto const subject = ctx.
tx[~sfSubject];
27 auto const issuer = ctx.
tx[~sfIssuer];
29 if (!subject && !issuer)
32 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: "
33 "No Subject or Issuer fields.";
38 if ((subject && subject->isZero()) || (issuer && issuer->isZero()))
40 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: Subject or Issuer "
45 auto const credType = ctx.
tx[sfCredentialType];
48 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: invalid size of CredentialType.";
59 auto const subject = ctx.
tx[~sfSubject].value_or(account);
60 auto const issuer = ctx.
tx[~sfIssuer].value_or(account);
61 auto const credType(ctx.
tx[sfCredentialType]);
75 auto const credType(
ctx_.
tx[sfCredentialType]);
83 JLOG(
j_.
trace()) <<
"Can't delete non-expired credential.";
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.
static TER preclaim(PreclaimContext const &ctx)
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
virtual LedgerHeader const & header() const =0
Returns information about the ledger.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
bool checkExpired(std::shared_ptr< SLE const > const &sleCredential, NetClock::time_point const &closed)
TER deleteSLE(ApplyView &view, std::shared_ptr< SLE > const &sleCredential, beast::Journal j)
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 FlagValue tfUniversalMask
std::size_t constexpr maxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.