refactor(mining): surface inconclusive benchmark; dedup idle combo

- mining_benchmark: when a thread benchmark finishes with no nonzero
  hashrate sample (e.g. the pool never reported a rate), don't finish
  silently — set a new `inconclusive` flag on ThreadBenchmarkUpdate and
  let mining_tab warn. Keeps the state-machine core pure/no-I/O (it is
  unit-tested), rather than calling the Notifications singleton from it.
- mining_controls: fold the two byte-identical idle-delay combo blocks
  (non-scaling + thread-scaling branches) into one lambda parameterised
  by combo id; removes ~30 lines of duplication.
- request_payment: drop the dead s_selected_addr_idx state and write the
  address-selected comparisons as std::string == char* consistently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 15:09:08 -05:00
parent 658c0f355b
commit ec48538881
5 changed files with 24 additions and 38 deletions

View File

@@ -25,7 +25,6 @@ static char s_address[512] = "";
static double s_amount = 0.0;
static char s_memo[512] = "";
static char s_label[128] = "";
static int s_selected_addr_idx = -1;
static std::string s_payment_uri;
static uintptr_t s_qr_texture = 0;
static int s_qr_width = 0;
@@ -45,7 +44,6 @@ void RequestPaymentDialog::show(const std::string& address)
s_amount = 0.0;
s_memo[0] = '\0';
s_label[0] = '\0';
s_selected_addr_idx = -1;
s_uri_dirty = true;
if (!address.empty()) {
@@ -107,13 +105,13 @@ void RequestPaymentDialog::render(App* app)
label = label.substr(0, zAddrFrontLbl.truncate) + "..." + label.substr(label.length() - zAddrBackLbl.truncate);
}
if (ImGui::Selectable(label.c_str(), s_address == addr.address)) {
if (ImGui::Selectable(label.c_str(), addr.address == s_address)) {
strncpy(s_address, addr.address.c_str(), sizeof(s_address) - 1);
s_uri_dirty = true;
}
}
}
// T-addresses
if (!state.t_addresses.empty()) {
ImGui::TextDisabled("%s", TR("request_transparent_addrs"));
@@ -124,7 +122,7 @@ void RequestPaymentDialog::render(App* app)
label = label.substr(0, tAddrFrontLbl.truncate) + "..." + label.substr(label.length() - tAddrBackLbl.truncate);
}
if (ImGui::Selectable(label.c_str(), s_address == addr.address)) {
if (ImGui::Selectable(label.c_str(), addr.address == s_address)) {
strncpy(s_address, addr.address.c_str(), sizeof(s_address) - 1);
s_uri_dirty = true;
}