Skip to content

Commit e07b2c4

Browse files
authored
Merge pull request #499 from frstrtr/dashboard/v36-active-live-latch
web(version_signaling): surface live latched share_version as ground-truth v36_active
2 parents f63f20e + 0ca390d commit e07b2c4

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

src/core/web_server.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6104,9 +6104,17 @@ nlohmann::json MiningInterface::rest_version_signaling(const nlohmann::json* cac
61046104
} else {
61056105
effective_state = "voting";
61066106
}
6107+
// The chain-derived state above can momentarily disagree with what the
6108+
// node is ACTUALLY mining: m_cached_share_version is the live ratchet
6109+
// output (the version stamped on this node's new shares). Surface it as
6110+
// ground truth so a transient sampling dip cannot make the dashboard
6111+
// claim "voting" while the node has already latched to V36 (charter #3).
6112+
int64_t live_share_version = m_cached_share_version;
61076113
result["auto_ratchet"] = {
61086114
{"state", effective_state},
61096115
{"persisted_state", effective_state},
6116+
{"live_share_version", live_share_version},
6117+
{"v36_active", live_share_version >= TARGET_VERSION},
61106118
{"activated_at", nullptr},
61116119
{"activated_height", nullptr},
61126120
{"confirmed_at", nullptr}
@@ -6130,12 +6138,20 @@ nlohmann::json MiningInterface::rest_v36_status()
61306138
nlohmann::json vs = rest_version_signaling();
61316139

61326140
std::string state = "voting";
6133-
if (vs.contains("auto_ratchet") && vs["auto_ratchet"].contains("state"))
6134-
state = vs["auto_ratchet"].value("state", std::string("voting"));
6141+
int64_t live_share_version = m_cached_share_version;
6142+
bool v36_active = live_share_version >= 36;
6143+
if (vs.contains("auto_ratchet")) {
6144+
const auto& ar = vs["auto_ratchet"];
6145+
state = ar.value("state", std::string("voting"));
6146+
live_share_version = ar.value("live_share_version", live_share_version);
6147+
v36_active = ar.value("v36_active", v36_active);
6148+
}
61356149

61366150
result["auto_ratchet"] = {
61376151
{"state", state},
61386152
{"persisted_state", state},
6153+
{"live_share_version", live_share_version},
6154+
{"v36_active", v36_active},
61396155
{"activated_at", nullptr},
61406156
{"activated_height", nullptr},
61416157
{"confirmed_at", nullptr}

0 commit comments

Comments
 (0)