6 #ifndef KAGOME_TRANSACTION_POOL_IMPL_HPP 7 #define KAGOME_TRANSACTION_POOL_IMPL_HPP 20 class TaggedTransactionQueue;
26 class TransactionsTransmitter;
34 std::shared_ptr<runtime::TaggedTransactionQueue> ttq,
35 std::shared_ptr<crypto::Hasher> hasher,
36 std::shared_ptr<network::TransactionsTransmitter> tx_transmitter,
37 std::unique_ptr<PoolModerator> moderator,
38 std::shared_ptr<blockchain::BlockHeaderRepository> header_repo,
39 std::shared_ptr<primitives::events::ExtrinsicSubscriptionEngine>
41 std::shared_ptr<subscription::ExtrinsicEventKeyRepository> ext_key_repo,
52 const std::unordered_map<Transaction::Hash, std::shared_ptr<Transaction>>
53 &getPendingTransactions()
const override;
55 outcome::result<Transaction::Hash> submitExtrinsic(
59 outcome::result<void> submitOne(Transaction &&tx)
override;
61 outcome::result<Transaction> removeOne(
64 std::map<Transaction::Hash, std::shared_ptr<Transaction>>
65 getReadyTransactions()
const override;
67 outcome::result<std::vector<Transaction>> removeStale(
70 Status getStatus()
const override;
72 outcome::result<primitives::Transaction> constructTransaction(
77 outcome::result<void> submitOne(
const std::shared_ptr<Transaction> &tx);
79 outcome::result<void> processTransaction(
80 const std::shared_ptr<Transaction> &tx);
82 outcome::result<void> processTransactionAsReady(
83 const std::shared_ptr<Transaction> &tx);
85 outcome::result<void> processTransactionAsWaiting(
86 const std::shared_ptr<Transaction> &tx);
88 outcome::result<void> ensureSpace()
const;
90 bool hasSpaceInReady()
const;
92 void addTransactionAsWaiting(
const std::shared_ptr<Transaction> &tx);
94 void delTransactionAsWaiting(
const std::shared_ptr<Transaction> &tx);
97 void postponeTransaction(
const std::shared_ptr<Transaction> &tx);
100 void processPostponedTransactions();
102 void provideTag(
const Transaction::Tag &tag);
104 void unprovideTag(
const Transaction::Tag &tag);
106 void commitRequiredTags(
const std::shared_ptr<Transaction> &tx);
108 void commitProvidedTags(
const std::shared_ptr<Transaction> &tx);
110 void rollbackRequiredTags(
const std::shared_ptr<Transaction> &tx);
112 void rollbackProvidedTags(
const std::shared_ptr<Transaction> &tx);
114 bool checkForReady(
const std::shared_ptr<const Transaction> &tx)
const;
116 void setReady(
const std::shared_ptr<Transaction> &tx);
118 void unsetReady(
const std::shared_ptr<Transaction> &tx);
120 bool isInReady(
const std::shared_ptr<const Transaction> &tx)
const;
126 std::shared_ptr<primitives::events::ExtrinsicSubscriptionEngine>
130 std::shared_ptr<runtime::TaggedTransactionQueue>
ttq_;
138 std::unordered_map<Transaction::Hash, std::shared_ptr<Transaction>>
142 std::unordered_map<Transaction::Hash, std::weak_ptr<Transaction>>
149 std::multimap<Transaction::Tag, std::weak_ptr<Transaction>>
153 std::multimap<Transaction::Tag, std::weak_ptr<Transaction>>
168 #endif // KAGOME_TRANSACTION_POOL_IMPL_HPP std::shared_ptr< blockchain::BlockHeaderRepository > header_repo_
std::unique_ptr< PoolModerator > moderator_
bans stale and invalid transactions for some amount of time
metrics::Gauge * metric_ready_txs_
std::shared_ptr< crypto::Hasher > hasher_
std::unique_ptr< Registry > RegistryPtr
RegistryPtr createRegistry()
std::shared_ptr< soralog::Logger > Logger
std::shared_ptr< network::TransactionsTransmitter > tx_transmitter_
std::list< std::weak_ptr< Transaction > > postponed_txs_
List of ready transaction over limit. It will be process first of all.
std::multimap< Transaction::Tag, std::weak_ptr< Transaction > > tx_provides_tag_
Transactions which provides specific tags.
std::unordered_map< Transaction::Hash, std::shared_ptr< Transaction > > imported_txs_
All of imported transaction, contained in the pool.
std::multimap< Transaction::Tag, std::weak_ptr< Transaction > > tx_depends_on_tag_
Transactions with resolved requirement of a specific tag.
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
std::shared_ptr< runtime::TaggedTransactionQueue > ttq_
std::shared_ptr< subscription::ExtrinsicEventKeyRepository > ext_key_repo_
std::shared_ptr< primitives::events::ExtrinsicSubscriptionEngine > sub_engine_
Extrinsic class represents extrinsic.
Logger createLogger(const std::string &tag)
std::unordered_map< Transaction::Hash, std::weak_ptr< Transaction > > ready_txs_
Collection transaction with full-satisfied dependencies.
A gauge metric to represent a value that can arbitrarily go up and down.
std::multimap< Transaction::Tag, std::weak_ptr< Transaction > > tx_waits_tag_
Transactions with unresolved require of specific tags.