feat(mining): auto-balance driver, per-pool algo, live miner version

- app: periodic weighted-random auto-balance of the pool while pool-mining
  (~30-min cadence; restarts the miner only when the pick actually changes),
  plus snapshot + refresh accessors for the UI.
- app_network: resolve the xmrig algo per pool at start (pool.dragonx.cc =
  rx/dragonx, pool.dragonx.is = rx/hush; custom hosts keep the setting).
- xmrig_manager: schema-aware pool-side hashrate readout (fixes a silent 0 for
  Miningcore pools); expose the running miner's version from its HTTP API and a
  cached `xmrig --version` detection so the UI can show it before mining.
- wallet_state: carry the running miner's version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-01 14:35:22 -05:00
parent d0586e5e75
commit 5c490c8d53
6 changed files with 237 additions and 20 deletions

View File

@@ -43,6 +43,7 @@ public:
double pool_diff = 0;
std::string pool_url;
std::string algo;
std::string version; // miner version reported by the running xmrig API
bool connected = false;
// Memory usage
int64_t memory_free = 0; // bytes
@@ -137,6 +138,18 @@ public:
*/
static std::string findXmrigBinary();
/**
* @brief Kick a one-shot background `<binary> --version` detection (idempotent).
* Lets the UI show the installed miner's version before mining is ever started.
*/
static void startVersionDetection();
/**
* @brief Cached installed-miner version parsed by startVersionDetection().
* Empty until detection completes (or if no binary/parse failed). Thread-safe.
*/
static std::string installedVersion();
private:
bool generateConfig(const Config& cfg, const std::string& outPath);
bool startProcess(const std::string& xmrigPath, const std::string& cfgPath, int threads);