34 #include <boost/program_options.hpp>
35 #include <boost/logic/tribool_fwd.hpp>
64 bool init(
const boost::program_options::variables_map& vm,
network_type nettype,
bool fallback_to_pow =
false);
65 static void init_options(boost::program_options::options_description& desc);
106 bool worker_thread();
107 bool request_block_template();
109 void update_autodetection();
113 uint64_t current_extra_message_index;
122 epee::critical_section m_template_lock;
124 std::atomic<
uint32_t> m_template_no;
125 std::atomic<
uint32_t> m_starter_nonce;
130 std::atomic<
uint32_t> m_threads_active;
131 std::atomic<
int32_t> m_pausers_count;
132 epee::critical_section m_miners_count_lock;
134 std::list<
boost::thread> m_threads;
135 epee::critical_section m_threads_lock;
138 epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval;
139 epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval;
140 epee::math_helper::once_a_time_seconds<1> m_autodetect_interval;
141 std::vector<
blobdata> m_extra_messages;
142 miner_config m_config;
143 std::
string m_config_folder_path;
144 std::atomic<
uint64_t> m_last_hr_merge_time;
146 std::atomic<
uint64_t> m_total_hashes;
147 std::atomic<
uint64_t> m_current_hash_rate;
148 epee::critical_section m_last_hash_rates_lock;
149 std::list<
uint64_t> m_last_hash_rates;
150 bool m_do_print_hashrate;
153 boost::thread::attributes m_attrs;
157 bool set_is_background_mining_enabled(
bool is_background_mining_enabled);
158 void set_ignore_battery(
bool ignore_battery);
159 bool background_worker_thread();
160 std::atomic<
bool> m_is_background_mining_enabled;
161 bool m_ignore_battery;
162 boost::mutex m_is_background_mining_enabled_mutex;
163 boost::condition_variable m_is_background_mining_enabled_cond;
164 std::atomic<
bool> m_is_background_mining_started;
165 boost::mutex m_is_background_mining_started_mutex;
166 boost::condition_variable m_is_background_mining_started_cond;
167 boost::thread m_background_mining_thread;
171 std::atomic<
uint64_t> m_miner_extra_sleep;
173 static
bool get_process_time(
uint64_t& total_time);
175 static
boost::logic::tribool on_battery_power();
176 std::atomic<
uint64_t> m_block_reward;
177 bool m_fallback_to_pow;
const account_public_address & get_mining_address() const
static constexpr uint8_t BACKGROUND_MINING_MAX_IDLE_THRESHOLD_PERCENTAGE
static constexpr uint8_t BACKGROUND_MINING_DEFAULT_IDLE_THRESHOLD_PERCENTAGE
static constexpr uint16_t BACKGROUND_MINING_DEFAULT_MIN_IDLE_INTERVAL_IN_SECONDS
static constexpr uint64_t BACKGROUND_MINING_MIN_MINER_EXTRA_SLEEP_MILLIS
static constexpr uint8_t BACKGROUND_MINING_MIN_IDLE_THRESHOLD_PERCENTAGE
uint64_t get_block_reward() const
static constexpr uint8_t BACKGROUND_MINING_DEFAULT_MINING_TARGET_PERCENTAGE
uint64_t get_min_idle_seconds() const
static constexpr uint16_t BACKGROUND_MINING_MIN_MIN_IDLE_INTERVAL_IN_SECONDS
static constexpr uint8_t BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS
uint64_t get_speed() const
static void init_options(boost::program_options::options_description &desc)
bool set_block_template(const block &bl, const difficulty_type &diffic, uint64_t height, uint64_t block_reward)
uint32_t get_threads_count() const
static constexpr uint8_t BACKGROUND_MINING_MAX_MINING_TARGET_PERCENTAGE
miner(i_miner_handler *phandler)
bool get_ignore_battery() const
bool set_min_idle_seconds(uint64_t min_idle_seconds)
bool on_block_chain_update()
bool get_is_background_mining_enabled() const
bool init(const boost::program_options::variables_map &vm, network_type nettype, bool fallback_to_pow=false)
static bool find_nonce_for_given_block(block &bl, const difficulty_type &diffic, uint64_t height)
static constexpr uint16_t BACKGROUND_MINING_MAX_MIN_IDLE_INTERVAL_IN_SECONDS
uint8_t get_idle_threshold() const
bool start(const account_public_address &adr, size_t threads_count, bool do_background=false, bool ignore_battery=false)
void do_print_hashrate(bool do_hr)
static constexpr uint64_t BACKGROUND_MINING_DEFAULT_MINER_EXTRA_SLEEP_MILLIS
uint8_t get_mining_target() const
bool set_idle_threshold(uint8_t idle_threshold)
bool set_mining_target(uint8_t mining_target)
static constexpr uint8_t BACKGROUND_MINING_MIN_MINING_TARGET_PERCENTAGE
#define KV_SERIALIZE(varialble)
#define END_KV_SERIALIZE_MAP()
#define BEGIN_KV_SERIALIZE_MAP()
Holds cryptonote related classes and helpers.
boost::multiprecision::uint128_t difficulty_type
unsigned __int64 uint64_t
virtual bool get_block_template(block &b, const account_public_address &adr, difficulty_type &diffic, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce)=0
virtual bool handle_block_found(block &b, block_verification_context &bvc)=0