20#include <xrpld/app/ledger/BuildLedger.h> 
   21#include <xrpld/app/ledger/Ledger.h> 
   22#include <xrpld/app/ledger/LedgerReplay.h> 
   23#include <xrpld/app/ledger/OpenLedger.h> 
   24#include <xrpld/app/misc/CanonicalTXSet.h> 
   25#include <xrpld/app/tx/apply.h> 
   27#include <xrpl/protocol/Feature.h> 
   37template <
class ApplyTxs>
 
   42    bool const closeTimeCorrect,
 
   50    if (built->isFlagLedger() && built->rules().enabled(featureNegativeUNL))
 
   52        built->updateNegativeUNL();
 
   61            !accum.
open(), 
"ripple::buildLedgerImpl : valid ledger state");
 
   62        applyTxs(accum, built);
 
   66    built->updateSkipList();
 
   73        JLOG(j.
debug()) << 
"Flushed " << asf << 
" accounts and " << tmf
 
   74                        << 
" transaction nodes";
 
   82        "ripple::buildLedgerImpl : valid ledger fees");
 
   83    built->setAccepted(closeTime, closeResolution, closeTimeCorrect);
 
 
  107    bool certainRetry = 
true;
 
  111    for (
int pass = 0; pass < LEDGER_TOTAL_PASSES; ++pass)
 
  113        JLOG(j.
debug()) << (certainRetry ? 
"Pass: " : 
"Final pass: ") << pass
 
  114                        << 
" begins (" << txns.
size() << 
" transactions)";
 
  117        auto it = txns.
begin();
 
  119        while (it != txns.
end())
 
  121            auto const txid = it->first.getTXID();
 
  125                if (pass == 0 && built->txExists(txid))
 
  132                    app, view, *it->second, certainRetry, 
tapNONE, j))
 
  151                    << 
"Transaction " << txid << 
" throws: " << ex.
what();
 
  157        JLOG(j.
debug()) << (certainRetry ? 
"Pass: " : 
"Final pass: ") << pass
 
  158                        << 
" completed (" << changes << 
" changes)";
 
  164        if (!changes && !certainRetry)
 
  168        if (!changes || (pass >= LEDGER_RETRY_PASSES))
 
  169            certainRetry = 
false;
 
  175        txns.
empty() || !certainRetry,
 
  176        "ripple::applyTransactions : retry transactions");
 
 
  185    bool const closeTimeCorrect,
 
  192    JLOG(j.
debug()) << 
"Report: Transaction Set = " << txns.
key() << 
", close " 
  194                    << (closeTimeCorrect ? 
"" : 
" (incorrect)");
 
  205                << 
"Attempting to apply " << txns.
size() << 
" transactions";
 
  212                    << 
"Applied " << applied << 
" transactions; " 
  213                    << failedTxns.
size() << 
" failed and " << txns.
size()
 
  214                    << 
" will be retried. " 
  215                    << 
"Total transactions in ledger (including Inner Batch): " 
  219                    << 
"Applied " << applied << 
" transactions. " 
  220                    << 
"Total transactions in ledger (including Inner Batch): " 
 
  233    auto const& replayLedger = replayData.
replay();
 
  235    JLOG(j.
debug()) << 
"Report: Replay Ledger " << replayLedger->info().hash;
 
  239        replayLedger->info().closeTime,
 
  241        replayLedger->info().closeTimeResolution,
 
  245            for (auto& tx : replayData.orderedTxns())
 
  246                applyTransaction(app, accum, *tx.second, false, applyFlags, j);
 
 
A generic endpoint for log messages.
 
Holds transactions which were deferred to the next pass of consensus.
 
const_iterator end() const
 
const_iterator begin() const
 
const_iterator erase(const_iterator const &it)
 
uint256 const & key() const
 
std::shared_ptr< Ledger const > const & parent() const
 
std::shared_ptr< Ledger const > const & replay() const
 
Writable ledger view that accumulates state and tx changes.
 
std::size_t txCount() const
Return the number of tx inserted since creation.
 
bool open() const override
Returns true if this reflects an open ledger.
 
void apply(TxsRawView &to) const
Apply changes.
 
Keylet const & fees() noexcept
The (fixed) index of the object containing the ledger fees.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::size_t applyTransactions(Application &app, std::shared_ptr< Ledger const > const &built, CanonicalTXSet &txns, std::set< TxID > &failed, OpenView &view, beast::Journal j)
Apply a set of consensus transactions to a ledger.
 
std::shared_ptr< Ledger > buildLedgerImpl(std::shared_ptr< Ledger const > const &parent, NetClock::time_point closeTime, bool const closeTimeCorrect, NetClock::duration closeResolution, Application &app, beast::Journal j, ApplyTxs &&applyTxs)
 
@ Success
Applied to this ledger.
 
@ Retry
Should be retried in this ledger.
 
@ Fail
Should not be retried in this ledger.
 
static constexpr std::uint32_t XRP_LEDGER_EARLIEST_FEES
The XRP Ledger mainnet's earliest ledger with a FeeSettings object.
 
static std::uint32_t const sLCF_NoConsensusTime
 
std::shared_ptr< Ledger > buildLedger(std::shared_ptr< Ledger const > const &parent, NetClock::time_point closeTime, bool const closeTimeCorrect, NetClock::duration closeResolution, Application &app, CanonicalTXSet &txns, std::set< TxID > &failedTxs, beast::Journal j)
Build a new ledger by applying consensus transactions.
 
ApplyTransactionResult applyTransaction(Application &app, OpenView &view, STTx const &tx, bool retryAssured, ApplyFlags flags, beast::Journal journal)
Transaction application helper.
 
T time_since_epoch(T... args)