20 #include <ripple/app/main/Application.h>
21 #include <ripple/app/misc/AmendmentTable.h>
22 #include <ripple/app/misc/NetworkOPs.h>
23 #include <ripple/app/tx/impl/Change.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/protocol/Indexes.h>
26 #include <ripple/protocol/TxFlags.h>
38 if (account != beast::zero)
40 JLOG(ctx.
j.
warn()) <<
"Change: Bad source id";
46 if (!fee.native() || fee != beast::zero)
48 JLOG(ctx.
j.
warn()) <<
"Change: invalid fee";
55 JLOG(ctx.
j.
warn()) <<
"Change: Bad signature";
61 JLOG(ctx.
j.
warn()) <<
"Change: Bad sequence";
75 JLOG(ctx.
j.
warn()) <<
"Change transaction against open ledger";
111 if (!amendmentObject)
113 amendmentObject = std::make_shared<SLE>(k);
119 if (
std::find(amendments.begin(), amendments.end(), amendment) !=
128 if (gotMajority && lostMajority)
138 for (
auto const& majority : oldMajorities)
140 if (majority.getFieldH256(
sfAmendment) == amendment)
154 if (!found && lostMajority)
161 auto& entry = newMajorities.
back();
168 JLOG(
j_.
warn()) <<
"Unsupported amendment " << amendment
169 <<
" received a majority.";
172 else if (!lostMajority)
175 amendments.push_back(amendment);
176 amendmentObject->setFieldV256(
sfAmendments, amendments);
182 JLOG(
j_.
error()) <<
"Unsupported amendment " << amendment
183 <<
" activated: server blocked.";
188 if (newMajorities.
empty())
191 amendmentObject->setFieldArray(
sfMajorities, newMajorities);
207 feeObject = std::make_shared<SLE>(k);
212 feeObject->setFieldU32(
215 feeObject->setFieldU32(
220 JLOG(
j_.
warn()) <<
"Fees have been changed";
TxType getTxnType() const
Keylet const & amendments() noexcept
The index of the amendment table.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const SField sfSigners(access, STI_ARRAY, 3, "Signers", SField::sMD_Default, SField::notSigning)
std::uint64_t getFieldU64(SField const &field) const
virtual AmendmentTable & getAmendmentTable()=0
STInteger< std::uint32_t > STUInt32
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
const SField sfMajorities(access, STI_ARRAY, 16, "Majorities")
void push_back(STObject const &object)
void preCompute() override
virtual void setAmendmentBlocked()=0
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
const std::uint32_t tfLostMajority
const SF_U32 sfReserveBase(access, STI_UINT32, 31, "ReserveBase")
const std::uint32_t tfGotMajority
virtual NetworkOPs & getOPs()=0
const SField sfMajority(access, STI_OBJECT, 18, "Majority")
NotTEC preflight0(PreflightContext const &ctx)
Performs early sanity checks on the txid.
AccountID getAccountID(SField const &field) const
const SF_U256 sfAmendment(access, STI_HASH256, 19, "Amendment")
const SF_U32 sfReferenceFeeUnits(access, STI_UINT32, 30, "ReferenceFeeUnits")
std::uint32_t getFlags() const
Blob getSigningPubKey() const
virtual bool enable(uint256 const &amendment)=0
virtual bool isSupported(uint256 const &amendment)=0
STBitString< 256 > STHash256
const SF_Amount sfFee(access, STI_AMOUNT, 8, "Fee")
std::uint32_t getSequence() const
static TER preclaim(PreclaimContext const &ctx)
State information when determining if a tx is likely to claim a fee.
std::size_t emplace_back(Args &&... args)
static NotTEC preflight(PreflightContext const &ctx)
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_U32 sfReserveIncrement(access, STI_UINT32, 32, "ReserveIncrement")
Blob getSignature() const
bool isFieldPresent(SField const &field) const
const SF_U32 sfCloseTime(access, STI_UINT32, 7, "CloseTime")
Keylet const & fees() noexcept
The (fixed) index of the object containing the ledger fees.
const SF_Vec256 sfAmendments(access, STI_VECTOR256, 3, "Amendments")
std::uint32_t getFieldU32(SField const &field) const
State information when preflighting a tx.
const SF_U64 sfBaseFee(access, STI_UINT64, 5, "BaseFee")
virtual bool open() const =0
Returns true if this reflects an open ledger.
STAmount const & getFieldAmount(SField const &field) const
const SF_U256 sfPreviousTxnID(access, STI_HASH256, 5, "PreviousTxnID", SField::sMD_DeleteFinal)
TERSubset< CanCvtToNotTEC > NotTEC
uint256 getFieldH256(SField const &field) const