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>
74 ,
j_(
app_.journal(
"InboundTransactions"))
90 return it->second.mAcquire;
107 it->second.mSeq =
m_seq;
108 if (it->second.mAcquire)
110 it->second.mAcquire->stillNeed();
113 return it->second.mSet;
119 ta = std::make_shared<TransactionAcquire>(
122 auto& obj =
m_map[hash];
140 protocol::TMLedgerData& packet = *packet_ptr;
142 JLOG(
j_.
trace()) <<
"Got data (" << packet.nodes().size()
143 <<
") for acquiring ledger: " << hash;
154 data.reserve(packet.nodes().size());
156 for (
auto const& node : packet.nodes())
158 if (!node.has_nodeid() || !node.has_nodedata())
175 if (!ta->takeNodes(data, peer).isUseful())
183 bool fromAcquire)
override
190 auto& inboundSet =
m_map[hash];
192 if (inboundSet.mSeq <
m_seq)
193 inboundSet.mSeq =
m_seq;
198 inboundSet.mSet =
set;
200 inboundSet.mAcquire.reset();
227 if (it->second.mSeq < minSeq || it->second.mSeq > maxSeq)
274 return std::make_unique<InboundTransactionsImp>(
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)
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)
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.
InboundTransactionsImp(Application &app, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet, std::unique_ptr< PeerSetBuilder > peerSetBuilder)
void giveSet(uint256 const &hash, std::shared_ptr< SHAMap > const &set, bool fromAcquire) override
Add a transaction set.
std::recursive_mutex mLock
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::shared_ptr< SHAMap > mSet
InboundTransactionSet & m_zeroSet
std::unique_ptr< PeerSetBuilder > m_peerSetBuilder
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,...
A generic endpoint for log messages.
std::shared_ptr< SHAMap > getSet(uint256 const &hash, bool acquire) override
Find and return a transaction set, or nullptr if it is missing.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unique_ptr< PeerSetBuilder > make_PeerSetBuilder(Application &app)
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
Manages the acquisition and lifetime of transaction sets.