20 #include <ripple/app/tx/impl/DID.h>
22 #include <ripple/basics/Log.h>
23 #include <ripple/ledger/ApplyView.h>
24 #include <ripple/ledger/View.h>
25 #include <ripple/protocol/Feature.h>
26 #include <ripple/protocol/Indexes.h>
27 #include <ripple/protocol/TxFlags.h>
28 #include <ripple/protocol/st.h>
67 auto isTooLong = [&](
auto const& sField,
std::size_t length) ->
bool {
68 if (
auto field = ctx.
tx[~sField])
69 return field->length() > length;
97 if (balance < reserve)
125 auto update = [&](
auto const& sField) {
126 if (
auto const field =
ctx_.
tx[~sField])
130 sleDID->makeFieldAbsent(sField);
134 (*sleDID)[sField] = *field;
142 if (!sleDID->isFieldPresent(
sfURI) &&
144 !sleDID->isFieldPresent(
sfData))
153 auto const sleDID = std::make_shared<SLE>(didKeylet);
156 auto set = [&](
auto const& sField) {
157 if (
auto const field =
ctx_.
tx[~sField]; field && !field->empty())
158 (*sleDID)[sField] = *field;
186 auto const sle = ctx.
view().
peek(sleKeylet);
204 JLOG(j.
fatal()) <<
"Unable to delete DID Token from owner.";
TER addSLE(ApplyContext &ctx, std::shared_ptr< SLE > const &sle, AccountID const &owner)
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
const SF_UINT32 sfOwnerCount
uint256 const & key() const
Returns the 'key' (or 'index') of this item.
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
A pair of SHAMap key and LedgerEntryType.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
const SF_UINT64 sfOwnerNode
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
static NotTEC preflight(PreflightContext const &ctx)
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
constexpr std::size_t maxDIDURILength
The maximum length of a URI inside a DID.
Keylet did(AccountID const &account) noexcept
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
const beast::Journal journal
static NotTEC preflight(PreflightContext const &ctx)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Writeable view to a ledger, for applying a transaction.
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
Integers of any length that is a multiple of 32-bits.
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.
static TER deleteSLE(ApplyContext &ctx, Keylet sleKeylet, AccountID const owner)
TERSubset< CanCvtToTER > TER
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
std::uint32_t getFlags() const
constexpr std::size_t maxDIDDocumentLength
The maximum length of a Data element inside a DID.
State information when applying a tx.
A generic endpoint for log messages.
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.
const SF_VL sfDIDDocument
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
bool isFieldPresent(SField const &field) const
const SF_AMOUNT sfBalance
@ tecINSUFFICIENT_RESERVE
constexpr std::size_t maxDIDAttestationLength
The maximum length of an Attestation inside a DID.
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.
constexpr std::uint32_t tfUniversalMask
TERSubset< CanCvtToNotTEC > NotTEC