Skip to content

Commit 9d2d34d

Browse files
committed
Fix warning messages for embedded mode, fix duplicate Explorer button
Warnings now show "EMBEDDED LTC NODE" / "EMBEDDED NODE" instead of "DAEMON" when running in embedded mode, with appropriate message ("No new blocks from P2P peers" vs "Check that it isn't frozen"). Explorer nav button: use remove-then-add pattern instead of existence check to prevent duplicate buttons from race between page init and multipool.js reloadCurrencyAndRefresh.
1 parent 001ae52 commit 9d2d34d

7 files changed

Lines changed: 26 additions & 13 deletions

File tree

src/core/web_server.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,13 +4069,16 @@ nlohmann::json MiningInterface::rest_local_stats()
40694069
{
40704070
auto warnings = nlohmann::json::array();
40714071

4072-
// 1. LTC daemon contact check (>60s since last work update)
4072+
// 1. LTC block source contact check (>60s since last work update)
40734073
auto now_s = std::chrono::duration_cast<std::chrono::seconds>(
40744074
std::chrono::steady_clock::now().time_since_epoch()).count();
4075-
if (m_last_work_update_time > 0 && now_s - m_last_work_update_time > 60)
4076-
warnings.push_back("LOST CONTACT WITH LTC DAEMON for "
4075+
if (m_last_work_update_time > 0 && now_s - m_last_work_update_time > 60) {
4076+
std::string src = m_embedded_node ? "EMBEDDED LTC NODE" : "LTC DAEMON";
4077+
warnings.push_back("LOST CONTACT WITH " + src + " for "
40774078
+ std::to_string(now_s - m_last_work_update_time) + "s! "
4078-
"Check that it isn't frozen or dead!");
4079+
+ (m_embedded_node ? "No new blocks received from P2P peers."
4080+
: "Check that it isn't frozen or dead!"));
4081+
}
40794082

40804083
// 2. No work template yet
40814084
{
@@ -4091,9 +4094,12 @@ nlohmann::json MiningInterface::rest_local_stats()
40914094
auto chain_infos = m_mm_manager->get_chain_infos();
40924095
for (const auto& ci : chain_infos) {
40934096
int64_t threshold = 180; // 3 minutes default (covers DOGE 1min blocks)
4094-
if (ci.last_update_age_s > threshold)
4095-
warnings.push_back("LOST CONTACT WITH " + ci.symbol + " DAEMON for "
4096-
+ std::to_string(ci.last_update_age_s) + "s!");
4097+
if (ci.last_update_age_s > threshold) {
4098+
std::string src = m_embedded_node ? " EMBEDDED NODE" : " DAEMON";
4099+
warnings.push_back("LOST CONTACT WITH " + ci.symbol + src + " for "
4100+
+ std::to_string(ci.last_update_age_s) + "s!"
4101+
+ (m_embedded_node ? " No new blocks from P2P peers." : ""));
4102+
}
40974103
}
40984104
}
40994105

web-static/dashboard.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,8 @@ <h4>Legend</h4>
27642764
// Inject Explorer nav link when explorer is enabled
27652765
if (info && info.explorer_enabled && info.explorer_url) {
27662766
var nav = document.querySelector('nav');
2767-
if (nav && !document.getElementById('nav-explorer')) {
2767+
var _old = document.getElementById('nav-explorer'); if (_old) _old.remove();
2768+
if (nav) {
27682769
var classicLink = nav.querySelector('a[href="index.html"]');
27692770
var a = document.createElement('a');
27702771
a.id = 'nav-explorer';

web-static/graphs.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,10 @@ <h2>Memory Usage</h2>
595595
} else {
596596
d3.json('../web/currency_info', function(currency_info) {
597597
if (currency_info && currency_info.explorer_enabled && currency_info.explorer_url) {
598+
var old = document.getElementById('nav-explorer');
599+
if (old) old.remove();
598600
var nav = document.querySelector('nav');
599-
if (nav && !document.getElementById('nav-explorer')) {
601+
if (nav) {
600602
var a = document.createElement('a');
601603
a.id = 'nav-explorer';
602604
a.href = currency_info.explorer_url;

web-static/miner.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,8 @@ <h3>Maturing Merged Rewards</h3>
15261526
document.getElementById('payout_label').textContent = symbol + ' on next block';
15271527
if (info && info.explorer_enabled && info.explorer_url) {
15281528
var nav = document.querySelector('nav');
1529-
if (nav && !document.getElementById('nav-explorer')) {
1529+
var _old = document.getElementById('nav-explorer'); if (_old) _old.remove();
1530+
if (nav) {
15301531
var a = document.createElement('a');
15311532
a.id = 'nav-explorer';
15321533
a.href = info.explorer_url;

web-static/miners.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ <h2>🔗 Merged Mining Blocks <span class="badge" id="merged_blocks_count" style
646646
d3.selectAll('.symbol-small').text((info && info.symbol) || 'DASH');
647647
if (info && info.explorer_enabled && info.explorer_url) {
648648
var nav = document.querySelector('nav');
649-
if (nav && !document.getElementById('nav-explorer')) {
649+
var _old = document.getElementById('nav-explorer'); if (_old) _old.remove();
650+
if (nav) {
650651
var a = document.createElement('a');
651652
a.id = 'nav-explorer';
652653
a.href = info.explorer_url;

web-static/share.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,8 @@ <h1 style="font-size: 1.3rem; font-weight: 600; color: #008de4; margin: 0;">c2po
10041004
d3.json('../web/currency_info', function(currency_info) {
10051005
if (currency_info && currency_info.explorer_enabled && currency_info.explorer_url) {
10061006
var nav = document.querySelector('nav');
1007-
if (nav && !document.getElementById('nav-explorer')) {
1007+
var _old = document.getElementById('nav-explorer'); if (_old) _old.remove();
1008+
if (nav) {
10081009
var a = document.createElement('a');
10091010
a.id = 'nav-explorer';
10101011
a.href = currency_info.explorer_url;

web-static/stratum.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,8 @@ <h2>📡 Connections by IP</h2>
12251225
d3.json('../web/currency_info', function(info) {
12261226
if (info && info.explorer_enabled && info.explorer_url) {
12271227
var nav = document.querySelector('nav');
1228-
if (nav && !document.getElementById('nav-explorer')) {
1228+
var _old = document.getElementById('nav-explorer'); if (_old) _old.remove();
1229+
if (nav) {
12291230
var a = document.createElement('a');
12301231
a.id = 'nav-explorer';
12311232
a.href = info.explorer_url;

0 commit comments

Comments
 (0)