20 #include <ripple/app/tx/impl/SetAccount.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/core/Config.h>
23 #include <ripple/ledger/View.h>
24 #include <ripple/protocol/Feature.h>
25 #include <ripple/protocol/Indexes.h>
26 #include <ripple/protocol/PublicKey.h>
27 #include <ripple/protocol/Quality.h>
28 #include <ripple/protocol/st.h>
65 JLOG(j.trace()) <<
"Malformed transaction: Invalid flags set.";
72 if ((uSetFlag != 0) && (uSetFlag == uClearFlag))
74 JLOG(j.trace()) <<
"Malformed transaction: Set and clear same flag.";
81 bool bSetRequireAuth =
83 bool bClearRequireAuth =
86 if (bSetRequireAuth && bClearRequireAuth)
88 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
95 bool bSetRequireDest =
97 bool bClearRequireDest =
100 if (bSetRequireDest && bClearRequireDest)
102 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
109 bool bSetDisallowXRP =
111 bool bClearDisallowXRP =
114 if (bSetDisallowXRP && bClearDisallowXRP)
116 JLOG(j.trace()) <<
"Malformed transaction: Contradictory flags set.";
125 if (uRate && (uRate < QUALITY_ONE))
128 <<
"Malformed transaction: Transfer rate too small.";
132 if (uRate > 2 * QUALITY_ONE)
135 <<
"Malformed transaction: Transfer rate too large.";
145 ((uTickSize < Quality::minTickSize) ||
146 (uTickSize > Quality::maxTickSize)))
148 JLOG(j.trace()) <<
"Malformed transaction: Bad tick size.";
157 JLOG(j.trace()) <<
"Invalid message key specified.";
165 JLOG(j.trace()) <<
"domain too long";
188 bool bSetRequireAuth =
198 JLOG(ctx.
j.
trace()) <<
"Retry: Owner directory not empty.";
222 bool const bSetRequireDest{
224 bool const bClearRequireDest{
226 bool const bSetRequireAuth{
228 bool const bClearRequireAuth{
230 bool const bSetDisallowXRP{
232 bool const bClearDisallowXRP{
235 bool const sigWithMaster{[&tx, &acct =
account_]() {
236 auto const spk = tx.getSigningPubKey();
253 JLOG(
j_.
trace()) <<
"Set RequireAuth.";
259 JLOG(
j_.
trace()) <<
"Clear RequireAuth.";
268 JLOG(
j_.
trace()) <<
"Set lsfRequireDestTag.";
274 JLOG(
j_.
trace()) <<
"Clear lsfRequireDestTag.";
283 JLOG(
j_.
trace()) <<
"Set lsfDisallowXRP.";
289 JLOG(
j_.
trace()) <<
"Clear lsfDisallowXRP.";
300 JLOG(
j_.
trace()) <<
"Must use master key to disable master key.";
311 JLOG(
j_.
trace()) <<
"Set lsfDisableMaster.";
317 JLOG(
j_.
trace()) <<
"Clear lsfDisableMaster.";
326 JLOG(
j_.
trace()) <<
"Set lsfDefaultRipple.";
331 JLOG(
j_.
trace()) <<
"Clear lsfDefaultRipple.";
342 JLOG(
j_.
trace()) <<
"Must use master key to set NoFreeze.";
346 JLOG(
j_.
trace()) <<
"Set NoFreeze flag";
353 JLOG(
j_.
trace()) <<
"Set GlobalFreeze flag";
363 JLOG(
j_.
trace()) <<
"Clear GlobalFreeze flag";
372 JLOG(
j_.
trace()) <<
"Set AccountTxnID.";
378 JLOG(
j_.
trace()) <<
"Clear AccountTxnID.";
389 JLOG(
j_.
trace()) <<
"Set lsfDepositAuth.";
394 JLOG(
j_.
trace()) <<
"Clear lsfDepositAuth.";
408 JLOG(
j_.
trace()) <<
"unset email hash";
413 JLOG(
j_.
trace()) <<
"set email hash";
427 JLOG(
j_.
trace()) <<
"unset wallet locator";
432 JLOG(
j_.
trace()) <<
"set wallet locator";
444 if (messageKey.
empty())
446 JLOG(
j_.
debug()) <<
"set message key";
451 JLOG(
j_.
debug()) <<
"set message key";
465 JLOG(
j_.
trace()) <<
"unset domain";
470 JLOG(
j_.
trace()) <<
"set domain";
482 if (uRate == 0 || uRate == QUALITY_ONE)
484 JLOG(
j_.
trace()) <<
"unset transfer rate";
489 JLOG(
j_.
trace()) <<
"set transfer rate";
500 if ((uTickSize == 0) || (uTickSize == Quality::maxTickSize))
502 JLOG(
j_.
trace()) <<
"unset tick size";
507 JLOG(
j_.
trace()) <<
"set tick size";
512 if (uFlagsIn != uFlagsOut)
513 sle->setFieldU32(
sfFlags, uFlagsOut);
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
const SF_Account sfRegularKey(access, STI_ACCOUNT, 8, "RegularKey")
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
const std::uint32_t tfRequireAuth
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Stream trace() const
Severity stream access functions.
boost::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const std::uint32_t asfGlobalFreeze
const SF_Blob sfMessageKey(access, STI_VL, 2, "MessageKey")
const std::uint32_t asfDefaultRipple
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
const SF_U32 sfFlags(access, STI_UINT32, 2, "Flags")
const uint256 featureDepositAuth
const SF_U256 sfWalletLocator(access, STI_HASH256, 7, "WalletLocator")
const std::uint32_t asfDepositAuth
const std::uint32_t asfDisallowXRP
const std::uint32_t tfOptionalDestTag
static const std::size_t DOMAIN_BYTES_MAX
static const std::uint32_t requireDestTag
const std::uint32_t asfAccountTxnID
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
const SF_U256 sfAccountTxnID(access, STI_HASH256, 9, "AccountTxnID")
const std::uint32_t tfDisallowXRP
const std::uint32_t tfAllowXRP
const std::uint32_t asfRequireAuth
Keylet account(AccountID const &id) noexcept
AccountID root.
AccountID calcAccountID(PublicKey const &pk)
std::uint32_t getFlags() const
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
const std::uint32_t asfRequireDest
State information when determining if a tx is likely to claim a fee.
const std::uint32_t asfDisableMaster
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
const std::uint32_t asfNoFreeze
const std::uint32_t tfOptionalAuth
static NotTEC preflight(PreflightContext const &ctx)
const SF_U32 sfClearFlag(access, STI_UINT32, 34, "ClearFlag")
const std::uint32_t tfAccountSetMask
const SF_U32 sfTransferRate(access, STI_UINT32, 11, "TransferRate")
std::uint32_t getFieldU32(SField const &field) const
State information when preflighting a tx.
static Keylet signers(AccountID const &account, std::uint32_t page) noexcept
const SF_U128 sfEmailHash(access, STI_HASH128, 1, "EmailHash")
const SF_U32 sfSetFlag(access, STI_UINT32, 33, "SetFlag")
const SF_U8 sfTickSize(access, STI_UINT8, 16, "TickSize")
static bool affectsSubsequentTransactionAuth(STTx const &tx)
static TER preclaim(PreclaimContext const &ctx)
const SF_Blob sfDomain(access, STI_VL, 7, "Domain")