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;
132 epee::critical_section m_miners_count_lock;
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;
142 miner_config m_config;
143 std::
string m_config_folder_path;
148 epee::critical_section m_last_hash_rates_lock;
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;
173 static
bool get_process_time(
uint64_t& total_time);
175 static
boost::logic::tribool on_battery_power();
177 bool m_fallback_to_pow;
uint64_t get_min_idle_seconds() const
static constexpr uint16_t BACKGROUND_MINING_DEFAULT_MIN_IDLE_INTERVAL_IN_SECONDS
bool set_block_template(const block &bl, const difficulty_type &diffic, uint64_t height, uint64_t block_reward)
uint8_t get_mining_target() const
bool set_mining_target(uint8_t mining_target)
virtual bool handle_block_found(block &b, block_verification_context &bvc)=0
uint8_t get_idle_threshold() const
static constexpr uint8_t BACKGROUND_MINING_MAX_IDLE_THRESHOLD_PERCENTAGE
static constexpr uint8_t BACKGROUND_MINING_MIN_MINING_TARGET_PERCENTAGE
static constexpr uint64_t BACKGROUND_MINING_MIN_MINER_EXTRA_SLEEP_MILLIS
#define KV_SERIALIZE(varialble)
static constexpr uint8_t BACKGROUND_MINING_DEFAULT_MINING_TARGET_PERCENTAGE
static constexpr uint8_t BACKGROUND_MINING_MAX_MINING_TARGET_PERCENTAGE
bool init(const boost::program_options::variables_map &vm, network_type nettype, bool fallback_to_pow=false)
static void init_options(boost::program_options::options_description &desc)
static constexpr uint8_t BACKGROUND_MINING_MIN_IDLE_THRESHOLD_PERCENTAGE
miner(i_miner_handler *phandler)
Holds cryptonote related classes and helpers.
bool start(const account_public_address &adr, size_t threads_count, bool do_background=false, bool ignore_battery=false)
static constexpr uint8_t BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS
uint32_t get_threads_count() const
bool on_block_chain_update()
static constexpr uint64_t BACKGROUND_MINING_DEFAULT_MINER_EXTRA_SLEEP_MILLIS
static constexpr uint8_t BACKGROUND_MINING_DEFAULT_IDLE_THRESHOLD_PERCENTAGE
const account_public_address & get_mining_address() const
unsigned __int64 uint64_t
bool set_idle_threshold(uint8_t idle_threshold)
static constexpr uint16_t BACKGROUND_MINING_MIN_MIN_IDLE_INTERVAL_IN_SECONDS
uint64_t get_speed() const
boost::multiprecision::uint128_t difficulty_type
void do_print_hashrate(bool do_hr)
static bool find_nonce_for_given_block(block &bl, const difficulty_type &diffic, uint64_t height)
bool get_ignore_battery() const
bool get_is_background_mining_enabled() const
uint64_t get_block_reward() const
static constexpr uint16_t BACKGROUND_MINING_MAX_MIN_IDLE_INTERVAL_IN_SECONDS
#define END_KV_SERIALIZE_MAP()
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
#define BEGIN_KV_SERIALIZE_MAP()
bool set_min_idle_seconds(uint64_t min_idle_seconds)