20 #include <ripple/app/ledger/InboundLedgers.h>
21 #include <ripple/app/ledger/InboundTransactions.h>
22 #include <ripple/app/ledger/impl/TransactionAcquire.h>
23 #include <ripple/app/main/Application.h>
24 #include <ripple/app/misc/NetworkOPs.h>
25 #include <ripple/basics/Log.h>
26 #include <ripple/core/JobQueue.h>
27 #include <ripple/protocol/RippleLedgerHash.h>
28 #include <ripple/resource/Fees.h>
71 :
Stoppable(
"InboundTransactions", parent)
91 return it->second.mAcquire;
110 it->second.mSeq =
m_seq;
111 if (it->second.mAcquire)
113 it->second.mAcquire->stillNeed();
116 return it->second.mSet;
122 ta = std::make_shared<TransactionAcquire>(
app_, hash);
124 auto& obj =
m_map[hash];
142 protocol::TMLedgerData& packet = *packet_ptr;
145 <<
"Got data (" << packet.nodes().size()
147 "for acquiring ledger: "
160 for (
auto const& node : packet.nodes())
162 if (!node.has_nodeid() || !node.has_nodedata())
178 node.nodedata().begin(), node.nodedata().end());
181 if (!ta->takeNodes(nodeIDs, nodeData, peer).isUseful())
189 bool fromAcquire)
override
196 auto& inboundSet =
m_map[hash];
198 if (inboundSet.mSeq <
m_seq)
199 inboundSet.mSeq =
m_seq;
204 inboundSet.mSet =
set;
206 inboundSet.mAcquire.reset();
233 if (it->second.mSeq < minSeq || it->second.mSeq > maxSeq)
276 return std::make_unique<InboundTransactionsImp>(
277 app, parent, collector, std::move(gotSet));
const Charge feeInvalidRequest
Schedule of fees charged for imposing load on the server.
virtual Family & getNodeFamily()=0
InboundTransactionSet(std::uint32_t seq, std::shared_ptr< SHAMap > const &set)
void stopped()
Called by derived classes to indicate that the stoppable has stopped.
Stream trace() const
Severity stream access functions.
std::optional< SHAMapNodeID > deserializeSHAMapNodeID(void const *data, std::size_t size)
Return an object representing a serialized SHAMap Node ID.
void giveSet(uint256 const &hash, std::shared_ptr< SHAMap > const &set, bool fromAcquire) override
Add a transaction set.
std::recursive_mutex mLock
void onStop() override
Override called when the stop notification is issued.
Provides an interface for starting and stopping.
std::shared_ptr< SHAMap > mSet
InboundTransactionSet & m_zeroSet
std::function< void(std::shared_ptr< SHAMap > const &, bool)> m_gotSet
TransactionAcquire::pointer getAcquire(uint256 const &hash)
const Charge feeUnwantedData
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::shared_ptr< SHAMap > getSet(uint256 const &hash, bool acquire) override
Find and return a transaction set, or nullptr if it is missing.
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual beast::Journal journal(std::string const &name)=0
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.
virtual ~InboundTransactions()=0
void newRound(std::uint32_t seq) override
Informs the container if a new consensus round.
TransactionAcquire::pointer mAcquire
InboundTransactionsImp(Application &app, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
std::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
Manages the acquisition and lifetime of transaction sets.
bool isStopping() const
Returns true if the stoppable should stop.