3#include <xrpld/app/ledger/detail/TimeoutCounter.h>
4#include <xrpld/app/main/Application.h>
5#include <xrpld/overlay/Peer.h>
6#include <xrpld/overlay/PeerSet.h>
8#include <xrpl/basics/CountedObject.h>
9#include <xrpl/basics/base_uint.h>
10#include <xrpl/beast/clock/abstract_clock.h>
11#include <xrpl/json/json_value.h>
12#include <xrpl/ledger/Ledger.h>
13#include <xrpl/nodestore/Database.h>
14#include <xrpl/shamap/SHAMap.h>
15#include <xrpl/shamap/SHAMapAddNode.h>
16#include <xrpl/shamap/SHAMapNodeID.h>
161 protocol::TMLedgerData
const& packet,
Abstract interface to a clock.
std::chrono::steady_clock::time_point time_point
clock_type::time_point lastAction_
json::Value getJson(int)
Return a json::ValueType::Object.
void tryDB(node_store::Database &srcDB)
void trigger(std::shared_ptr< Peer > const &, TriggerReason)
Request more nodes, perhaps from a specific peer.
InboundLedger(Application &app, uint256 const &hash, std::uint32_t seq, Reason reason, clock_type &, std::unique_ptr< PeerSet > peerSet)
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
void runData()
Process pending TMLedgerData Query the a random sample of the 'best' peers.
std::size_t getPeerCount() const
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Called with a lock by the PeerSet when the timer expires.
std::vector< uint256 > neededStateHashes(int max, SHAMapSyncFilter const *filter) const
void receiveNode(std::shared_ptr< Peer > const &peer, protocol::TMLedgerData const &packet, SHAMapAddNode &san)
Process node data received from a peer Call with a lock.
int processData(std::shared_ptr< Peer > peer, protocol::TMLedgerData const &data)
Process one TMLedgerData Returns the number of useful nodes.
bool takeHeader(std::string_view data)
Take ledger header data Call with a lock.
bool takeAsRootNode(std::string_view data, SHAMapAddNode &san)
Process AS root node received from a peer Call with a lock.
void filterNodes(std::vector< std::pair< SHAMapNodeID, uint256 > > &nodes, TriggerReason reason)
std::shared_ptr< Ledger > ledger_
bool isComplete() const
Returns true if we got all the data.
std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > receivedData_
std::pair< protocol::TMGetObjectByHash::ObjectType, uint256 > neededHash_t
std::uint32_t getSeq() const
std::mutex receivedDataLock_
std::unique_ptr< PeerSet > peerSet_
void addPeers()
Add more peers to the set, if possible.
bool takeTxRootNode(std::string_view data, SHAMapAddNode &san)
Process AS root node received from a peer Call with a lock.
beast::AbstractClock< std::chrono::steady_clock > clock_type
void init(ScopedLockType &collectionLock)
void update(std::uint32_t seq)
bool isFailed() const
Returns false if we failed to get the data.
std::vector< uint256 > neededTxHashes(int max, SHAMapSyncFilter const *filter) const
clock_type::time_point getLastAction() const
std::set< uint256 > recentNodes_
bool gotData(std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > const &)
Stash a TMLedgerData received from a peer for later processing Returns 'true' if we need to dispatch.
std::shared_ptr< Ledger const > getLedger() const
std::vector< neededHash_t > getNeededHashes()
~InboundLedger() override
TimeoutCounter(Application &app, uint256 const &targetHash, std::chrono::milliseconds timeoutInterval, QueueJobParameter &&jobParameter, beast::Journal journal)
std::unique_lock< std::recursive_mutex > ScopedLockType
Persistency layer for NodeObject.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.