20#include <xrpld/app/ledger/ConsensusTransSetSF.h> 
   21#include <xrpld/app/ledger/InboundLedgers.h> 
   22#include <xrpld/app/ledger/InboundTransactions.h> 
   23#include <xrpld/app/ledger/detail/TransactionAcquire.h> 
   24#include <xrpld/app/main/Application.h> 
   25#include <xrpld/app/misc/NetworkOPs.h> 
   31using namespace std::chrono_literals;
 
   50          app.journal(
"TransactionAcquire"))
 
   52    , mPeerSet(std::move(peerSet))
 
 
   75        auto const pap = &
app_;
 
   82            jtTXN_DATA, 
"completeAcquire", [pap, hash, map]() {
 
   83                pap->getInboundTransactions().giveSet(hash, map, 
true);
 
 
  127                               << (peer ? 
"havePeer" : 
"noPeer") << 
" no root";
 
  128        protocol::TMGetLedger tmGL;
 
  130        tmGL.set_itype(protocol::liTS_CANDIDATE);
 
  131        tmGL.set_querydepth(3);  
 
  134            tmGL.set_querytype(protocol::qtINDIRECT);
 
  139    else if (!
mMap->isValid())
 
  147        auto nodes = 
mMap->getMissingNodes(256, &sf);
 
  160        protocol::TMGetLedger tmGL;
 
  162        tmGL.set_itype(protocol::liTS_CANDIDATE);
 
  165            tmGL.set_querytype(protocol::qtINDIRECT);
 
  167        for (
auto const& node : nodes)
 
  169            *tmGL.add_nodeids() = node.first.getRawString();
 
 
  201        for (
auto const& d : data)
 
  203            if (d.first.isRoot())
 
  207                        << 
"Got root TXS node, already have it";
 
  208                else if (!
mMap->addRootNode(
 
  212                    JLOG(
journal_.
warn()) << 
"TX acquire got bad root node";
 
  217            else if (!
mMap->addKnownNode(d.first, d.second, &sf).isGood())
 
  219                JLOG(
journal_.
warn()) << 
"TX acquire got bad non-root node";
 
  231            << 
"Peer " << peer->id()
 
  232            << 
" sent us junky transaction node data: " << ex.
what();
 
 
  242        [
this](
auto peer) { 
return peer->hasTxSet(
hash_); },
 
  243        [
this](
auto peer) { 
trigger(peer); });
 
 
Stream trace() const
Severity stream access functions.
 
virtual NodeCache & getTempNodeCache()=0
 
virtual JobQueue & getJobQueue()=0
 
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
 
static SHAMapAddNode invalid()
 
static SHAMapAddNode useful()
 
Identifies a node inside a SHAMap.
 
std::string getRawString() const
 
This class is an "active" object.
 
bool progress_
Whether forward progress has been made.
 
void setTimer(ScopedLockType &)
Schedule a call to queueJob() after mTimerInterval.
 
uint256 const hash_
The hash of the object (in practice, always a ledger) we are trying to fetch.
 
std::recursive_mutex mtx_
 
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Hook called from invokeOnTimer().
 
void trigger(std::shared_ptr< Peer > const &)
 
TransactionAcquire(Application &app, uint256 const &hash, std::unique_ptr< PeerSet > peerSet)
 
void init(int startPeers)
 
std::shared_ptr< SHAMap > mMap
 
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
 
void addPeers(std::size_t limit)
 
std::unique_ptr< PeerSet > mPeerSet
 
SHAMapAddNode takeNodes(std::vector< std::pair< SHAMapNodeID, Slice > > const &data, std::shared_ptr< Peer > const &)
 
static constexpr std::size_t size()
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
auto constexpr TX_ACQUIRE_TIMEOUT
 
T shared_from_this(T... args)