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>
72 :
Stoppable(
"InboundTransactions", parent)
93 return it->second.mAcquire;
112 it->second.mSeq =
m_seq;
113 if (it->second.mAcquire)
115 it->second.mAcquire->stillNeed();
118 return it->second.mSet;
124 ta = std::make_shared<TransactionAcquire>(
app_, hash,
m_clock);
126 auto& obj =
m_map[hash];
144 protocol::TMLedgerData& packet = *packet_ptr;
147 <<
"Got data (" << packet.nodes().size()
149 "for acquiring ledger: "
162 for (
auto const& node : packet.nodes())
164 if (!node.has_nodeid() || !node.has_nodedata() ||
165 (node.nodeid().size() != 33))
172 node.nodeid().data(),
static_cast<int>(node.nodeid().size()));
174 node.nodedata().begin(), node.nodedata().end());
177 if (!ta->takeNodes(nodeIDs, nodeData, 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();
221 for (
auto const& it :
m_map)
224 set[
"seq"] = it.second.mSeq;
226 set[
"state"] =
"complete";
227 else if (it.second.mAcquire)
228 set[
"state"] =
"acquiring";
230 set[
"state"] =
"dead";
257 if (it->second.mSeq < minSeq || it->second.mSeq > maxSeq)
303 return std::make_unique<InboundTransactionsImp>(
304 app, clock, parent, collector, std::move(gotSet));
const Charge feeInvalidRequest
Schedule of fees charged for imposing load on the server.
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.
@ arrayValue
array value (ordered list)
void giveSet(uint256 const &hash, std::shared_ptr< SHAMap > const &set, bool fromAcquire) override
Gives set to the container.
std::recursive_mutex mLock
std::string to_string(ListDisposition disposition)
beast::abstract_clock< std::chrono::steady_clock > clock_type
Provides an interface for starting and stopping.
std::shared_ptr< SHAMap > mSet
InboundTransactionSet & m_zeroSet
virtual Family & family()=0
@ objectValue
object value (collection of name/value pairs).
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::unique_ptr< InboundTransactions > make_InboundTransactions(Application &app, InboundLedgers::clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
std::shared_ptr< SHAMap > getSet(uint256 const &hash, bool acquire) override
Retrieves a transaction set by hash.
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
InboundTransactionsImp(Application &app, clock_type &clock, Stoppable &parent, beast::insight::Collector::ptr const &collector, std::function< void(std::shared_ptr< SHAMap > const &, bool)> gotSet)
Json::Value getInfo() override
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.
bool isStopping() const
Returns true if the stoppable should stop.