Kagome
Polkadot Runtime Engine in C++17
|
#include <pool_moderator_impl.hpp>
Classes | |
struct | Params |
Public Member Functions | |
PoolModeratorImpl (std::shared_ptr< clock::SystemClock > clock, Params parameters) | |
~PoolModeratorImpl () override=default | |
void | ban (const common::Hash256 &tx_hash) override |
bool | banIfStale (primitives::BlockNumber current_block, const Transaction &tx) override |
bool | isBanned (const common::Hash256 &tx_hash) const override |
void | updateBan () override |
size_t | bannedNum () const override |
Public Member Functions inherited from kagome::transaction_pool::PoolModerator | |
virtual | ~PoolModerator ()=default |
virtual bool | isBanned (const Transaction::Hash &tx_hash) const =0 |
Static Public Attributes | |
static constexpr size_t | kDefaultExpectedSize = 2048 |
static constexpr clock::SystemClock::Duration | kDefaultBanFor |
Private Types | |
using | Map = std::map< common::Hash256, clock::SystemClock::TimePoint > |
Private Attributes | |
std::shared_ptr< clock::SystemClock > | clock_ |
Params | params_ |
Map | banned_until_ |
Definition at line 17 of file pool_moderator_impl.hpp.
struct kagome::transaction_pool::PoolModeratorImpl::Params |
ban_for | amount of time for which a transaction is banned |
expected_size | expected maximum number of banned transactions. If significantly exceeded, some transactions will be removed from ban list |
Definition at line 37 of file pool_moderator_impl.hpp.
Class Members | ||
---|---|---|
Duration | ban_for | |
size_t | expected_size |
|
private |
Definition at line 18 of file pool_moderator_impl.hpp.
kagome::transaction_pool::PoolModeratorImpl::PoolModeratorImpl | ( | std::shared_ptr< clock::SystemClock > | clock, |
Params | parameters | ||
) |
parameters | configuration of the pool moderator |
clock | a clock used to determine when it is time to unban a transaction |
Definition at line 12 of file pool_moderator_impl.cpp.
|
overridedefault |
|
overridevirtual |
Bans a transaction for a fixed amount of time
tx_hash |
Implements kagome::transaction_pool::PoolModerator.
Definition at line 16 of file pool_moderator_impl.cpp.
|
overridevirtual |
Bans a transaction
tx | if its longevity is past |
current_block |
Implements kagome::transaction_pool::PoolModerator.
Definition at line 25 of file pool_moderator_impl.cpp.
|
overridevirtual |
Return the number of currently banned transactions
Implements kagome::transaction_pool::PoolModerator.
Definition at line 55 of file pool_moderator_impl.cpp.
|
override |
Definition at line 34 of file pool_moderator_impl.cpp.
|
overridevirtual |
Unbans transaction which ban time is exceeded
Implements kagome::transaction_pool::PoolModerator.
Definition at line 44 of file pool_moderator_impl.cpp.
|
private |
Definition at line 66 of file pool_moderator_impl.hpp.
|
private |
Definition at line 64 of file pool_moderator_impl.hpp.
|
static |
Default ban duration
Definition at line 29 of file pool_moderator_impl.hpp.
|
static |
Default value of expected size parameter
Definition at line 24 of file pool_moderator_impl.hpp.
|
private |
Definition at line 65 of file pool_moderator_impl.hpp.