Repository navigation
fix(sync): the explorer sync check runs on mainnet only - #51
Merged
Merged
Conversation
Cabecinha84
approved these changes
Oct 22, 2026
Cabecinha84
left a comment
Member
There was a problem hiding this comment.
ack.
Minor nits (not blocking)
- The cached chain never expires. If a node's flux.conf switches between testnet and mainnet and fluxd is restarted
while the watchdog keeps running, the old chain stays in memory until the watchdog restarts. On a testnet→mainnet
switch the sync check would stay off. This is rare and the trade-off is reasonable. A one-line comment saying so
would be enough. - The repo has no CI. No checks run on the branch, so the green tests come only from the author's run and mine.
- The version bump was removed (the version is set at release). That is fine; just remember to bump the patch version
when releasing.
Author
|
The check compares fluxd's height with the Flux explorers, which serve mainnet. On testnet, labnet or regtest it always read "not synced" and restarted a healthy fluxd. The watchdog reads fluxd's chain once fluxd answers and runs the check on mainnet alone; an unknown chain is not mainnet, so the check waits for the answer rather than acting on a guess. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fluxd restarted on another chain is seen at its next check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uxd_chain.js, with tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MorningLightMountain713
force-pushed
the
fix/sync-check-mainnet-only
branch
from
October 27, 2026 13:58
c532d2c to
88b01ab
Compare
Merged
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.
Summary
The explorer sync check runs on mainnet only.
Check_Synccompares fluxd's height with explorer.runonflux.io and explorer.zelcash.online, which serve mainnet. On any other chain (testnet, labnet, regtest) the comparison always reads "not synced" — a labnet node at height 9569 against a network height of ~3,040,000 — and the fix action stops and starts a healthy fluxd.On the cycles where the existing random skip lets the check run, the watchdog reads fluxd's chain from
getblockchaininfo(chain:main,test,labnet,regtest) and runs the check only when the chain ismain; on another chain it logs why the check is off. The chain is read every time the check would run, so a fluxd restarted on another chain is seen at its next check. An unreadable answer (fluxd not answering, still loading, output without a chain) is unknown, never mainnet, and the check does not run that cycle. Mainnet behaviour is unchanged.fluxd_chain.js:fluxdChain(result)(the chain named bygetblockchaininfo's output, or null),syncCheckApplies(chain)(mainnet only), andrunSyncCheck(one cycle: the random skip, then the chain read andCheck_Syncon mainnet).watchdog.js:flux_check()callsrunSyncCheckwith the real roll,getblockchaininfo,Check_Syncand log.Tests
test/fluxd_chain.test.js: the chain read for each network; empty, error text, an RPC error object, an empty or non-string chain,null, no stdout and no result are all unknown; the check applies onmainonly. MakingsyncCheckAppliesaccept any known chain, or defaulting an unknown chain tomain, each fails a test.runSyncCheck: a skip roll neither asks fluxd nor checks; a check roll onmainchecks; another chain logs and does not check; no answer does not check; a chain change between two cycles is followed. Removing the skip, asking before the roll, checking on any chain, treating no answer as mainnet, dropping the log, or keeping the first chain read each fails a test.npm test36 pass; eslint and prettier clean.On nodes (at
30bb225)Flux daemon is not synced (9569, diff: 3030437)→systemctl stop fluxd.service/start; "not synced" again 19:49, 19:53Sync check off: the explorers it compares with serve mainnet, and fluxd is on labnet; no sync line and no fluxd stop over the next four cyclesFlux daemon is synced (…)on the cycles it runssynced (3040050)20:02,synced (3040074)20:14, random skips betweenOn nodes (at
c532d2c)Sync check off: the explorers it compares with serve mainnet, and fluxd is on labnetand 209 random skips; no height comparison and no fluxd stop (fluxd running since 10:00:27).Flux daemon is synced (3070010, diff: 0)and(3070030, …)on the cycles the roll let through.🤖 Generated with Claude Code