3#include <boost/circular_buffer.hpp>
12class TransactionManager;
26 std::shared_ptr<TransactionManager> trx_mgr =
nullptr, std::shared_ptr<DbStorage> db = {});
54 void init(
const std::shared_ptr<DbStorage> &db);
std::shared_mutex mutex_
Definition gas_pricer.hpp:60
void update(const SharedTransactions &trxs)
updates gas price after each executed block
Definition gas_pricer.cpp:81
boost::circular_buffer< u256 > price_list_
Definition gas_pricer.hpp:62
GasPricer & operator=(GasPricer &&)=delete
const u256 kMinimumPrice
Definition gas_pricer.hpp:57
GasPricer(const GasPricer &)=delete
void init(const std::shared_ptr< DbStorage > &db)
initialize values on start from blocks in DB
Definition gas_pricer.cpp:36
const bool kBlocksGasPricer
Definition gas_pricer.hpp:65
GasPricer & operator=(const GasPricer &)=delete
u256 bid() const
returns current gas price
Definition gas_pricer.cpp:27
std::unique_ptr< std::thread > init_daemon_
Definition gas_pricer.hpp:64
std::shared_ptr< TransactionManager > trx_mgr_
Definition gas_pricer.hpp:66
const bool kIsLightNode
Definition gas_pricer.hpp:58
u256 latest_price_
Definition gas_pricer.hpp:61
~GasPricer()
Definition gas_pricer.cpp:23
GasPricer(GasPricer &&)=delete
const uint64_t kPercentile
Definition gas_pricer.hpp:56
Basic gas price calculator. We calculate the gas price based on the lowest price in last number_of_bl...
Definition gas_pricer.hpp:23
std::vector< SharedTransaction > SharedTransactions
Definition transaction.hpp:86
Definition genesis.hpp:23