mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-11 06:08:02 +00:00
Compare commits
6 Commits
nb-slab
...
mvadari/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
909331db6d | ||
|
|
03d84784a9 | ||
|
|
8c405396b8 | ||
|
|
8972740b77 | ||
|
|
f19a964272 | ||
|
|
a224f998ea |
@@ -11,6 +11,7 @@
|
||||
#include <xrpl/json/to_string.h> // IWYU pragma: keep
|
||||
#include <xrpl/ledger/ApplyView.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/ledger/entries/TicketEntry.h>
|
||||
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
|
||||
#include <xrpl/ledger/helpers/CredentialHelpers.h>
|
||||
#include <xrpl/ledger/helpers/DelegateHelpers.h>
|
||||
@@ -815,8 +816,8 @@ Transactor::ticketDelete(
|
||||
{
|
||||
// Delete the Ticket, adjust the account root ticket count, and
|
||||
// reduce the owner count.
|
||||
SLE::pointer const sleTicket = view.peek(keylet::ticket(ticketIndex));
|
||||
if (!sleTicket)
|
||||
TicketEntryW ticket(ticketIndex, view, j);
|
||||
if (!ticket)
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
JLOG(j.fatal()) << "Ticket disappeared from ledger.";
|
||||
@@ -824,7 +825,7 @@ Transactor::ticketDelete(
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
std::uint64_t const page{(*sleTicket)[sfOwnerNode]};
|
||||
std::uint64_t const page{(*ticket)[sfOwnerNode]};
|
||||
if (!view.dirRemove(keylet::ownerDir(account), page, ticketIndex, true))
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
@@ -864,10 +865,10 @@ Transactor::ticketDelete(
|
||||
}
|
||||
|
||||
// Update the Ticket owner's reserve.
|
||||
decreaseOwnerCountForObject(view, sleAccount, sleTicket, 1, j);
|
||||
decreaseOwnerCountForObject(view, sleAccount, ticket.mutableRawSle(), 1, j);
|
||||
|
||||
// Remove Ticket from ledger.
|
||||
view.erase(sleTicket);
|
||||
ticket.erase();
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/core/ServiceRegistry.h>
|
||||
#include <xrpl/ledger/entries/TicketEntry.h>
|
||||
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
|
||||
#include <xrpl/ledger/helpers/DirectoryHelpers.h>
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
#include <xrpl/protocol/Keylet.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <xrpl/tx/applySteps.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -99,24 +98,24 @@ 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::rawTicket(curTicketSeq));
|
||||
SLE::pointer const sleTicket = std::make_shared<SLE>(ticketKeylet);
|
||||
TicketEntryW ticket(accountID_, SeqProxy::rawTicket(curTicketSeq), view());
|
||||
ticket.newSLE();
|
||||
|
||||
sleTicket->setAccountID(sfAccount, accountID_);
|
||||
sleTicket->setFieldU32(sfTicketSequence, curTicketSeq);
|
||||
ticket->setAccountID(sfAccount, accountID_);
|
||||
ticket->setFieldU32(sfTicketSequence, curTicketSeq);
|
||||
|
||||
view().insert(sleTicket);
|
||||
ticket.insert();
|
||||
|
||||
auto const page = view().dirInsert(
|
||||
keylet::ownerDir(accountID_), ticketKeylet, describeOwnerDir(accountID_));
|
||||
keylet::ownerDir(accountID_), ticket.keylet(), describeOwnerDir(accountID_));
|
||||
|
||||
JLOG(j_.trace()) << "Creating ticket " << to_string(ticketKeylet.key) << ": "
|
||||
JLOG(j_.trace()) << "Creating ticket " << to_string(ticket.key()) << ": "
|
||||
<< (page ? "success" : "failure");
|
||||
|
||||
if (!page)
|
||||
return tecDIR_FULL; // LCOV_EXCL_LINE
|
||||
|
||||
sleTicket->setFieldU64(sfOwnerNode, *page);
|
||||
ticket->setFieldU64(sfOwnerNode, *page);
|
||||
}
|
||||
|
||||
// Update the record of the number of Tickets this account owns.
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <xrpl/ledger/entries/XChainOwnedClaimIDEntry.h> // IWYU pragma: keep
|
||||
#include <xrpl/ledger/entries/XChainOwnedCreateAccountClaimIDEntry.h> // IWYU pragma: keep
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
#include <xrpl/protocol/Keylet.h>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
@@ -76,12 +77,22 @@ template class SLEBase<ApplyView>;
|
||||
#pragma push_macro("LEDGER_ENTRY")
|
||||
#undef LEDGER_ENTRY
|
||||
|
||||
// No explicit instantiation here, neither a definition nor a declaration.
|
||||
// A definition would instantiate an entry a second time once its member
|
||||
// bodies live in its own .cpp (MSVC rejects that with C4661 under /WX), and a
|
||||
// declaration (`extern template`) stops clang from emitting the inline
|
||||
// constructors of the header-only entries at -O0, which leaves them undefined
|
||||
// at link time in the debug builds. Naming the class in a static_assert is
|
||||
// enough to instantiate its definition, which is all this exhaustiveness
|
||||
// check needs; the per-type suites exercise the members.
|
||||
#define LEDGER_ENTRY(tag, value, name, ...) \
|
||||
template class name##Entry<ReadView>; \
|
||||
template class name##Entry<ApplyView>; \
|
||||
static_assert( \
|
||||
name##Entry<ReadView>::kEntryType == tag && name##Entry<ApplyView>::kEntryType == tag, \
|
||||
#name "Entry must be bound to " #tag);
|
||||
#name "Entry must be bound to " #tag); \
|
||||
static_assert( \
|
||||
std::is_constructible_v<name##Entry<ReadView>, Keylet const&, ReadView const&> && \
|
||||
std::is_constructible_v<name##Entry<ApplyView>, Keylet const&, ApplyView&>, \
|
||||
#name "Entry must be constructible from a Keylet and a view");
|
||||
|
||||
#include <xrpl/protocol/detail/ledger_entries.macro>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user