mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 18:40:28 +00:00
add raw prefixes
This commit is contained in:
@@ -59,7 +59,7 @@ public:
|
||||
* the "primary" sequence of a transaction, `sfSequence`.
|
||||
*/
|
||||
static constexpr SeqProxy
|
||||
sequence(std::uint32_t v)
|
||||
rawSequence(std::uint32_t v)
|
||||
{
|
||||
return SeqProxy{Type::Seq, v};
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
* the "primary" ticket sequence of a transaction, `sfTicketSequence`.
|
||||
*/
|
||||
static constexpr SeqProxy
|
||||
ticket(std::uint32_t v)
|
||||
rawTicket(std::uint32_t v)
|
||||
{
|
||||
return SeqProxy{Type::Ticket, v};
|
||||
}
|
||||
|
||||
@@ -200,16 +200,16 @@ STTx::getSeqProxy() const
|
||||
{
|
||||
std::uint32_t const seq{getFieldU32(sfSequence)};
|
||||
if (seq != 0)
|
||||
return SeqProxy::sequence(seq);
|
||||
return SeqProxy::rawSequence(seq);
|
||||
|
||||
std::optional<std::uint32_t> const ticketSeq{at(~sfTicketSequence)};
|
||||
if (!ticketSeq)
|
||||
{
|
||||
// No TicketSequence specified. Return the Sequence, whatever it is.
|
||||
return SeqProxy::sequence(seq);
|
||||
return SeqProxy::rawSequence(seq);
|
||||
}
|
||||
|
||||
return SeqProxy::ticket(*ticketSeq);
|
||||
return SeqProxy::rawTicket(*ticketSeq);
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
|
||||
@@ -709,7 +709,7 @@ Transactor::checkSeqProxy(ReadView const& view, STTx const& tx, beast::Journal j
|
||||
}
|
||||
|
||||
SeqProxy const tSeqProx = tx.getSeqProxy();
|
||||
SeqProxy const aSeq = SeqProxy::sequence((*sle)[sfSequence]);
|
||||
SeqProxy const aSeq = SeqProxy::rawSequence((*sle)[sfSequence]);
|
||||
|
||||
if (tSeqProx.isSeq())
|
||||
{
|
||||
|
||||
@@ -251,7 +251,7 @@ TxConsequences::TxConsequences(NotTEC pfResult)
|
||||
: isBlocker_(false)
|
||||
, fee_(beast::kZero)
|
||||
, potentialSpend_(beast::kZero)
|
||||
, seqProx_(SeqProxy::sequence(0))
|
||||
, seqProx_(SeqProxy::rawSequence(0))
|
||||
, sequencesConsumed_(0)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
|
||||
@@ -58,7 +58,8 @@ OfferCancel::doApply()
|
||||
if (!sle)
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
if (auto sleOffer = view().peek(keylet::offer(accountID_, SeqProxy::sequence(offerSequence))))
|
||||
if (auto sleOffer =
|
||||
view().peek(keylet::offer(accountID_, SeqProxy::rawSequence(offerSequence))))
|
||||
{
|
||||
JLOG(j_.debug()) << "Trying to cancel offer #" << offerSequence;
|
||||
return offerDelete(view(), sleOffer, ctx_.registry.get().getJournal("View"));
|
||||
|
||||
@@ -639,7 +639,7 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel)
|
||||
if (cancelSequence)
|
||||
{
|
||||
auto const sleCancel =
|
||||
sb.peek(keylet::offer(accountID_, SeqProxy::sequence(*cancelSequence)));
|
||||
sb.peek(keylet::offer(accountID_, SeqProxy::rawSequence(*cancelSequence)));
|
||||
|
||||
// It's not an error to not find the offer to cancel: it might have
|
||||
// been consumed or removed. If it is found, however, it's an error
|
||||
|
||||
@@ -93,7 +93,8 @@ EscrowCancel::preclaim(PreclaimContext const& ctx)
|
||||
{
|
||||
if (ctx.view.rules().enabled(featureTokenEscrow))
|
||||
{
|
||||
auto const k = keylet::escrow(ctx.tx[sfOwner], SeqProxy::sequence(ctx.tx[sfOfferSequence]));
|
||||
auto const k =
|
||||
keylet::escrow(ctx.tx[sfOwner], SeqProxy::rawSequence(ctx.tx[sfOfferSequence]));
|
||||
auto const slep = ctx.view.read(k);
|
||||
if (!slep)
|
||||
return tecNO_TARGET;
|
||||
@@ -118,7 +119,8 @@ EscrowCancel::preclaim(PreclaimContext const& ctx)
|
||||
TER
|
||||
EscrowCancel::doApply()
|
||||
{
|
||||
auto const k = keylet::escrow(ctx_.tx[sfOwner], SeqProxy::sequence(ctx_.tx[sfOfferSequence]));
|
||||
auto const k =
|
||||
keylet::escrow(ctx_.tx[sfOwner], SeqProxy::rawSequence(ctx_.tx[sfOfferSequence]));
|
||||
auto const slep = ctx_.view().peek(k);
|
||||
if (!slep)
|
||||
{
|
||||
|
||||
@@ -204,7 +204,8 @@ EscrowFinish::preclaim(PreclaimContext const& ctx)
|
||||
|
||||
if (ctx.view.rules().enabled(featureTokenEscrow))
|
||||
{
|
||||
auto const k = keylet::escrow(ctx.tx[sfOwner], SeqProxy::sequence(ctx.tx[sfOfferSequence]));
|
||||
auto const k =
|
||||
keylet::escrow(ctx.tx[sfOwner], SeqProxy::rawSequence(ctx.tx[sfOfferSequence]));
|
||||
auto const slep = ctx.view.read(k);
|
||||
if (!slep)
|
||||
return tecNO_TARGET;
|
||||
@@ -229,7 +230,8 @@ EscrowFinish::preclaim(PreclaimContext const& ctx)
|
||||
TER
|
||||
EscrowFinish::doApply()
|
||||
{
|
||||
auto const k = keylet::escrow(ctx_.tx[sfOwner], SeqProxy::sequence(ctx_.tx[sfOfferSequence]));
|
||||
auto const k =
|
||||
keylet::escrow(ctx_.tx[sfOwner], SeqProxy::rawSequence(ctx_.tx[sfOfferSequence]));
|
||||
auto const slep = ctx_.view().peek(k);
|
||||
if (!slep)
|
||||
{
|
||||
|
||||
@@ -595,7 +595,7 @@ LoanSet::doApply()
|
||||
|
||||
// Create the loan
|
||||
auto loan =
|
||||
std::make_shared<SLE>(keylet::loan(brokerID, SeqProxy::sequence(*loanSequenceProxy)));
|
||||
std::make_shared<SLE>(keylet::loan(brokerID, SeqProxy::rawSequence(*loanSequenceProxy)));
|
||||
|
||||
// Prevent copy/paste errors
|
||||
auto setLoanField = [&loan, &tx](auto const& field, std::uint32_t const defValue = 0) {
|
||||
|
||||
@@ -116,7 +116,7 @@ PermissionedDomainSet::doApply()
|
||||
|
||||
bool const fixEnabled = view().rules().enabled(fixCleanup3_1_3);
|
||||
auto const seq = fixEnabled ? ctx_.tx.getSeqValue() : ctx_.tx.getFieldU32(sfSequence);
|
||||
Keylet const pdKeylet = keylet::permissionedDomain(accountID_, SeqProxy::sequence(seq));
|
||||
Keylet const pdKeylet = keylet::permissionedDomain(accountID_, SeqProxy::rawSequence(seq));
|
||||
auto slePd = std::make_shared<SLE>(pdKeylet);
|
||||
|
||||
slePd->setAccountID(sfOwner, accountID_);
|
||||
|
||||
@@ -99,7 +99,7 @@ TicketCreate::doApply()
|
||||
for (std::uint32_t i = 0; i < ticketCount; ++i)
|
||||
{
|
||||
std::uint32_t const curTicketSeq = firstTicketSeq + i;
|
||||
Keylet const ticketKeylet = keylet::ticket(accountID_, SeqProxy::ticket(curTicketSeq));
|
||||
Keylet const ticketKeylet = keylet::ticket(accountID_, SeqProxy::rawTicket(curTicketSeq));
|
||||
SLE::pointer const sleTicket = std::make_shared<SLE>(ticketKeylet);
|
||||
|
||||
sleTicket->setAccountID(sfAccount, accountID_);
|
||||
|
||||
@@ -611,7 +611,7 @@ TEST(AccountSet, Ticket)
|
||||
|
||||
// Get alice's current sequence - the ticket will be created at seq + 1
|
||||
std::uint32_t const aliceSeqBefore = env.getAccountRoot(alice.id()).getSequence();
|
||||
auto const ticketSeq = SeqProxy::ticket(aliceSeqBefore + 1);
|
||||
auto const ticketSeq = SeqProxy::rawTicket(aliceSeqBefore + 1);
|
||||
|
||||
// Create a ticket
|
||||
EXPECT_EQ(env.submit(transactions::TicketCreateBuilder{alice, 1}, alice).ter, tesSUCCESS);
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
if (!sleAcct)
|
||||
return false;
|
||||
|
||||
SeqProxy const acctSeq = SeqProxy::sequence(sleAcct->getFieldU32(sfSequence));
|
||||
SeqProxy const acctSeq = SeqProxy::rawSequence(sleAcct->getFieldU32(sfSequence));
|
||||
SeqProxy const seqProx = txn.getSeqProxy();
|
||||
|
||||
if (seqProx.isSeq())
|
||||
|
||||
@@ -773,7 +773,7 @@ TxQ::apply(
|
||||
return {terNO_ACCOUNT, false};
|
||||
|
||||
// If the transaction needs a Ticket is that Ticket in the ledger?
|
||||
SeqProxy const acctSeqProx = SeqProxy::sequence((*sleAccount)[sfSequence]);
|
||||
SeqProxy const acctSeqProx = SeqProxy::rawSequence((*sleAccount)[sfSequence]);
|
||||
SeqProxy const txSeqProx = tx->getSeqProxy();
|
||||
if (txSeqProx.isTicket() && !view.exists(keylet::ticket(account, txSeqProx)))
|
||||
{
|
||||
@@ -1605,9 +1605,9 @@ TxQ::nextQueuableSeqImpl(SLE::const_ref sleAccount, std::scoped_lock<std::mutex>
|
||||
// If the account is not in the ledger or a non-account was passed
|
||||
// then return zero. We have no idea.
|
||||
if (!sleAccount || sleAccount->getType() != ltACCOUNT_ROOT)
|
||||
return SeqProxy::sequence(0);
|
||||
return SeqProxy::rawSequence(0);
|
||||
|
||||
SeqProxy const acctSeqProx = SeqProxy::sequence((*sleAccount)[sfSequence]);
|
||||
SeqProxy const acctSeqProx = SeqProxy::rawSequence((*sleAccount)[sfSequence]);
|
||||
|
||||
// If the account is not in the queue then acctSeqProx is good enough.
|
||||
auto const accountIter = byAccount_.find((*sleAccount)[sfAccount]);
|
||||
@@ -1669,7 +1669,7 @@ TxQ::tryDirectApply(
|
||||
if (!sleAccount)
|
||||
return {};
|
||||
|
||||
SeqProxy const acctSeqProx = SeqProxy::sequence((*sleAccount)[sfSequence]);
|
||||
SeqProxy const acctSeqProx = SeqProxy::rawSequence((*sleAccount)[sfSequence]);
|
||||
SeqProxy const txSeqProx = tx->getSeqProxy();
|
||||
|
||||
// Can only directly apply if the transaction sequence matches the account
|
||||
|
||||
@@ -49,7 +49,7 @@ parseVault(json::Value const& params, json::Value& jvResult)
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
uNodeIndex = keylet::vault(*id, SeqProxy::sequence(params[jss::seq].asUInt())).key;
|
||||
uNodeIndex = keylet::vault(*id, SeqProxy::rawSequence(params[jss::seq].asUInt())).key;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -260,7 +260,7 @@ doAccountInfo(RPC::JsonContext& context)
|
||||
|
||||
// We expect txs to be returned sorted by SeqProxy. Verify
|
||||
// that with a couple of asserts.
|
||||
SeqProxy prevSeqProxy = SeqProxy::sequence(0);
|
||||
SeqProxy prevSeqProxy = SeqProxy::rawSequence(0);
|
||||
for (auto const& tx : txs)
|
||||
{
|
||||
json::Value jvTx = json::ValueType::Object;
|
||||
|
||||
@@ -432,7 +432,7 @@ parseEscrow(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::escrow(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::escrow(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
auto const parseFeeSettings = fixed(keylet::feeSettings());
|
||||
@@ -494,7 +494,7 @@ parseLoanBroker(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::loanBroker(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::loanBroker(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
@@ -516,7 +516,7 @@ parseLoan(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::loan(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::loan(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
@@ -598,7 +598,7 @@ parseOffer(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::offer(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::offer(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
@@ -659,7 +659,7 @@ parsePermissionedDomain(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::permissionedDomain(*account, SeqProxy::sequence(pd[jss::seq].asUInt())).key;
|
||||
return keylet::permissionedDomain(*account, SeqProxy::rawSequence(pd[jss::seq].asUInt())).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
@@ -762,7 +762,7 @@ parseTicket(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::ticket(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::ticket(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
@@ -784,7 +784,7 @@ parseVault(
|
||||
if (!seq)
|
||||
return std::unexpected(seq.error());
|
||||
|
||||
return keylet::vault(*id, SeqProxy::sequence(*seq)).key;
|
||||
return keylet::vault(*id, SeqProxy::rawSequence(*seq)).key;
|
||||
}
|
||||
|
||||
static std::expected<uint256, json::Value>
|
||||
|
||||
Reference in New Issue
Block a user