Kagome
Polkadot Runtime Engine in C++17
pool_moderator_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_POOL_MODERATOR_IMPL_HPP
7 #define KAGOME_POOL_MODERATOR_IMPL_HPP
8 
10 
11 #include <map>
12 
13 #include "clock/clock.hpp"
14 
15 namespace kagome::transaction_pool {
16 
18  using Map = std::map<common::Hash256, clock::SystemClock::TimePoint>;
19 
20  public:
24  static constexpr size_t kDefaultExpectedSize = 2048;
25 
30  std::chrono::minutes(30);
31 
37  struct Params {
40  };
41 
47  PoolModeratorImpl(std::shared_ptr<clock::SystemClock> clock,
48  Params parameters);
49 
50  ~PoolModeratorImpl() override = default;
51 
52  void ban(const common::Hash256 &tx_hash) override;
53 
54  bool banIfStale(primitives::BlockNumber current_block,
55  const Transaction &tx) override;
56 
57  bool isBanned(const common::Hash256 &tx_hash) const override;
58 
59  void updateBan() override;
60 
61  size_t bannedNum() const override;
62 
63  private:
64  std::shared_ptr<clock::SystemClock> clock_;
67  };
68 
69 } // namespace kagome::transaction_pool
70 
71 #endif // KAGOME_POOL_MODERATOR_IMPL_HPP
bool banIfStale(primitives::BlockNumber current_block, const Transaction &tx) override
void ban(const common::Hash256 &tx_hash) override
bool isBanned(const common::Hash256 &tx_hash) const override
uint32_t BlockNumber
Definition: common.hpp:18
std::shared_ptr< clock::SystemClock > clock_
static constexpr clock::SystemClock::Duration kDefaultBanFor
typename ClockType::duration Duration
Definition: clock.hpp:23
std::map< common::Hash256, clock::SystemClock::TimePoint > Map
PoolModeratorImpl(std::shared_ptr< clock::SystemClock > clock, Params parameters)