3 #include <boost/circular_buffer.hpp>
4 #include <shared_mutex>
52 void init(
const std::shared_ptr<DbStorage> &db);
GasPricer(const GasPriceConfig &config, bool is_light_node=false, std::shared_ptr< DbStorage > db={})
Definition: gas_pricer.cpp:7
std::shared_mutex mutex_
Definition: gas_pricer.hpp:58
GasPricer & operator=(const GasPricer &)=delete
void update(const SharedTransactions &trxs)
updates gas price after each executed block
Definition: gas_pricer.cpp:72
boost::circular_buffer< u256 > price_list_
Definition: gas_pricer.hpp:60
const u256 kMinimumPrice
Definition: gas_pricer.hpp:55
GasPricer(const GasPricer &)=delete
void init(const std::shared_ptr< DbStorage > &db)
initialize values on start from blocks in DB
Definition: gas_pricer.cpp:28
u256 bid() const
returns current gas price
Definition: gas_pricer.cpp:23
std::unique_ptr< std::thread > init_daemon_
Definition: gas_pricer.hpp:62
const bool kIsLightNode
Definition: gas_pricer.hpp:56
u256 latest_price_
Definition: gas_pricer.hpp:59
~GasPricer()
Definition: gas_pricer.cpp:19
GasPricer(GasPricer &&)=delete
const uint64_t kPercentile
Definition: gas_pricer.hpp:54
GasPricer & operator=(GasPricer &&)=delete
Basic gas price calculator. We calculate the gas price based on the lowest price in last number_of_bl...
Definition: gas_pricer.hpp:22
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
Definition: Common.h:98
std::vector< SharedTransaction > SharedTransactions
Definition: transaction.hpp:81
Definition: genesis.hpp:12