20#include <xrpld/app/ledger/InboundLedgers.h>
21#include <xrpld/app/ledger/InboundTransactions.h>
22#include <xrpld/app/ledger/detail/TransactionAcquire.h>
23#include <xrpld/app/main/Application.h>
24#include <xrpld/app/misc/NetworkOPs.h>
25#include <xrpld/core/JobQueue.h>
27#include <xrpl/basics/Log.h>
28#include <xrpl/protocol/RippleLedgerHash.h>
29#include <xrpl/resource/Fees.h>
76 ,
j_(
app_.journal(
"InboundTransactions"))
92 return it->second.mAcquire;
109 it->second.mSeq =
m_seq;
110 if (it->second.mAcquire)
112 it->second.mAcquire->stillNeed();
115 return it->second.mSet;
121 ta = std::make_shared<TransactionAcquire>(
124 auto& obj =
m_map[hash];
142 protocol::TMLedgerData& packet = *packet_ptr;
144 JLOG(
j_.
trace()) <<
"Got data (" << packet.nodes().size()
145 <<
") for acquiring ledger: " << hash;
156 data.reserve(packet.nodes().size());
158 for (
auto const& node : packet.nodes())
160 if (!node.has_nodeid() || !node.has_nodedata())
177 if (!ta->takeNodes(data, peer).isUseful())
185 bool fromAcquire)
override
192 auto& inboundSet =
m_map[hash];
194 if (inboundSet.mSeq <
m_seq)
195 inboundSet.mSeq =
m_seq;
200 inboundSet.mSet =
set;
202 inboundSet.mAcquire.reset();
229 if (it->second.mSeq < minSeq || it->second.mSeq > maxSeq)
276 return std::make_unique<InboundTransactionsImp>(
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
virtual Family & getNodeFamily()=0
InboundTransactionSet(std::uint32_t seq, std::shared_ptr< SHAMap > const &set)
TransactionAcquire::pointer mAcquire
std::shared_ptr< SHAMap > mSet
void giveSet(uint256 const &hash, std::shared_ptr< SHAMap > const &set, bool fromAcquire) override
Add a transaction set.
void newRound(std::uint32_t seq) override
Informs the container if a new consensus round.
InboundTransactionSet & m_zeroSet
TransactionAcquire::pointer getAcquire(uint256 const &hash)
std::recursive_mutex mLock
std::function< void(std::shared_ptr< SHAMap > const &, bool)> m_gotSet
void gotData(LedgerHash const &hash, std::shared_ptr< Peer > peer, std::shared_ptr< protocol::TMLedgerData > packet_ptr) override
We received a TMLedgerData from a peer.
InboundTransactionsImp(Application &app, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet, std::unique_ptr< PeerSetBuilder > peerSetBuilder)
std::shared_ptr< SHAMap > getSet(uint256 const &hash, bool acquire) override
Find and return a transaction set, or nullptr if it is missing.
std::unique_ptr< PeerSetBuilder > m_peerSetBuilder
Manages the acquisition and lifetime of transaction sets.
virtual ~InboundTransactions()=0
Charge const feeMalformedRequest
Schedule of fees charged for imposing load on the server.
Charge const feeInvalidData
Charge const feeUselessData
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< SHAMapNodeID > deserializeSHAMapNodeID(void const *data, std::size_t size)
Return an object representing a serialized SHAMap Node ID.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)