web(d-web): emit primary-coin tip in node_topology auto-detect fallback - #454
Merged
Conversation
The /api/node_topology auto-detect fallback (used when no per-coin StatsProvider hook is wired) emitted coin/primary/peers/embedded/has_rpc but never height, so the topology card (PR #452 front-end) rendered the primary chain with peers but no tip on fallback nodes. Fill the primary entry with the embedded daemon REAL current block height from the cached template (m_cached_template[height] under m_work_mutex -- the same source rest_local_stats uses), guarded > 0 to match the front-end render guard. synced still requires the StatsProvider hook (is_blockchain_synced() is declared-but-unimplemented), so it is deliberately left to the hook path. Web layer only, no ICoinNode change -> no per-coin/consensus ripple.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
/api/node_topologyauto-detect fallback (the path used when no per-coin StatsProvider hook is wired) emittedcoin/primary/peers/embedded/has_rpcbut neverheight— so the topology card front-end (PR #452) rendered the primary chain with peers but no tip on fallback nodes.This fills the primary coin entry with the embedded daemon's REAL current block height from the cached template (
m_cached_template["height"]underm_work_mutex— the same sourcerest_local_statsalready uses), guarded> 0to match the front-end's render guard.Why (charter)
Charter #2: each node's dashboard must show that node's real topology, truthful and sourced from the same internal state debug.log uses. #452 surfaced synced/tip on the front-end, but the backend fallback never emitted tip — a node without the StatsProvider hook showed a less-truthful card than one with it. This closes that gap.
Scope / safety
ICoinNodeinterface change → no per-coin / consensus ripple (deliberately avoided, per the BCH-enum-gap precedent).syncedis not added here:is_blockchain_synced()is declared-but-unimplemented, so a truthful synced flag still requires the StatsProvider hook path. Left as-is rather than emit a fabricated value.