1#include <xrpld/app/ledger/BuildLedger.h> 
    2#include <xrpld/app/ledger/InboundLedger.h> 
    3#include <xrpld/app/ledger/LedgerReplay.h> 
    4#include <xrpld/app/ledger/LedgerReplayer.h> 
    5#include <xrpld/app/ledger/detail/LedgerDeltaAcquire.h> 
    6#include <xrpld/app/main/Application.h> 
    7#include <xrpld/core/JobQueue.h> 
    8#include <xrpld/overlay/PeerSet.h> 
   21          LedgerReplayParameters::SUB_TASK_TIMEOUT,
 
   25          app.journal(
"LedgerReplayDelta"))
 
   26    , inboundLedgers_(inboundLedgers)
 
   27    , ledgerSeq_(ledgerSeq)
 
   28    , peerSet_(std::move(peerSet))
 
   30    JLOG(journal_.trace()) << 
"Create " << hash_ << 
" Seq " << ledgerSeq;
 
 
   73                        << 
"Add a peer " << peer->id() << 
" for " << 
hash_;
 
   74                    protocol::TMReplayDeltaRequest request;
 
   76                    peerSet_->sendRequest(request, peer);
 
 
  146        << 
"failed to create a (info only) ledger from verified data " << 
hash_;
 
 
  167            << 
"task added to a finished LedgerDeltaAcquire " << 
hash_;
 
 
  185        "ripple::LedgerDeltaAcquire::tryBuild : parent sequence match");
 
  187        parent->info().hash == 
replayTemp_->info().parentHash,
 
  188        "ripple::LedgerDeltaAcquire::tryBuild : parent hash match");
 
  203                               << parent->info().hash;
 
  204        Throw<std::runtime_error>(
"Cannot replay ledger");
 
 
  214                           << (reason ? 
" for a new reason" : 
"");
 
  218    bool firstTime = 
true;
 
  222        reasons.push_back(*reason);
 
  229            for (
auto reason : reasons)
 
  234                        app.getLedgerMaster().storeLedger(ledger);
 
  243                app.getLedgerMaster().tryAdvance();
 
 
  250    XRPL_ASSERT(
isDone(), 
"ripple::LedgerDeltaAcquire::notify : is done");
 
  256    for (
auto& cb : toCall)
 
 
Stream trace() const
Severity stream access functions.
 
virtual Config & config()=0
 
virtual JobQueue & getJobQueue()=0
 
virtual Family & getNodeFamily()=0
 
virtual LedgerMaster & getLedgerMaster()=0
 
Manages the lifetime of inbound ledgers.
 
virtual std::shared_ptr< Ledger const > acquire(uint256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
 
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
 
std::shared_ptr< Ledger const  > fullLedger_
 
void trigger(std::size_t limit, ScopedLockType &sl)
Trigger another round.
 
std::set< InboundLedger::Reason > reasons_
 
LedgerDeltaAcquire(Application &app, InboundLedgers &inboundLedgers, uint256 const &ledgerHash, std::uint32_t ledgerSeq, std::unique_ptr< PeerSet > peerSet)
Constructor.
 
void processData(LedgerInfo const &info, std::map< std::uint32_t, std::shared_ptr< STTx const > > &&orderedTxns)
Process the data extracted from a peer's reply.
 
std::uint32_t noFeaturePeerCount
 
std::map< std::uint32_t, std::shared_ptr< STTx const  > > orderedTxns_
 
std::shared_ptr< Ledger const > tryBuild(std::shared_ptr< Ledger const > const &parent)
Try to build the ledger if not already.
 
std::shared_ptr< Ledger const  > replayTemp_
 
InboundLedgers & inboundLedgers_
 
std::uint32_t const ledgerSeq_
 
void init(int numPeers)
Start the LedgerDeltaAcquire task.
 
std::vector< OnDeltaDataCB > dataReadyCallbacks_
 
~LedgerDeltaAcquire() override
 
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Hook called from invokeOnTimer().
 
std::unique_ptr< PeerSet > peerSet_
 
void notify(ScopedLockType &sl)
Call the OnDeltaDataCB callbacks.
 
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
 
void addDataCallback(InboundLedger::Reason reason, OnDeltaDataCB &&cb)
Add a reason and a callback to the LedgerDeltaAcquire subtask.
 
void onLedgerBuilt(ScopedLockType &sl, std::optional< InboundLedger::Reason > reason={})
Process a newly built ledger, such as store it.
 
std::shared_ptr< Ledger const > getLedgerByHash(uint256 const &hash)
 
This class is an "active" object.
 
void setTimer(ScopedLockType &)
Schedule a call to queueJob() after mTimerInterval.
 
std::chrono::milliseconds timerInterval_
The minimum time to wait between calls to execute().
 
uint256 const hash_
The hash of the object (in practice, always a ledger) we are trying to fetch.
 
std::recursive_mutex mtx_
 
static constexpr std::size_t size()
 
auto constexpr SUB_TASK_FALLBACK_TIMEOUT
 
std::uint32_t constexpr MAX_QUEUED_TASKS
 
std::uint32_t constexpr SUB_TASK_MAX_TIMEOUTS
 
auto constexpr MAX_NO_FEATURE_PEER_COUNT
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
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.
 
T shared_from_this(T... args)