Repository navigation
explorer: a failed block is retried at the poll's pace, and a block fluxd does not hold yet is waited for - #1873
Merged
MorningLightMountain713 merged 5 commits intoNov 26, 2026
Conversation
Cabecinha84
requested changes
Nov 3, 2026
Cabecinha84
left a comment
Member
There was a problem hiding this comment.
Must-fix (small):
- Delay the catch-branch poll. Replace the immediate pollForNewBlocks() with pollTimeout =
setTimeout(pollForNewBlocks, POLL_INTERVAL_MS).- Today, if the cached isDaemonSynced().data.height is ever ahead of what getblock can serve, it loops poll →
processBlock → -8 → poll with no wait and now no logging. That can happen after a daemon rollback or
re-bootstrap. - I couldn't construct that case from code alone, so call it should-fix if you prefer, but it's a one-line change.
- Today, if the cached isDaemonSynced().data.height is ever ahead of what getblock can serve, it loops poll →
- Rebase onto development, dropping the bootstrap hunk.
- Put the new test inside the processBlock tests describe, where the stubs are in scope. A naive merge puts it in the
"fluxnode address record" describe, where it fails with ReferenceError: daemonServiceMiscRpcsStub is not defined. - Update the PR body and re-measure on the rebased head.
Non-blocking:
- The -8 match covers the whole try. A -8 thrown after partial processInsight writes would skip the DB restore. A
narrower check, such as blockHeight > syncStatus.data.height before the fetch, would avoid that. - The test only asserts that a log line is absent, so a bare return would also pass. Better to assert that the poller
ran and no restore happened. - The recoverAndRestart hunk has no test.
- The catch no longer logs the -8. That's fine, but a debug line would help diagnose if the delay is added.
MorningLightMountain713
force-pushed
the
fix/explorer-waits-for-blocks
branch
from
November 18, 2026 13:54
62cf8bc to
d31907e
Compare
…ock fluxd does not hold yet is waited for A block fluxd refuses was recovered from with no wait, and recovery asked for it again with none, so the processor restored its database and retried as fast as fluxd answered for as long as fluxd read as synced. Recovery from a failed block now waits POLL_INTERVAL_MS. A block fluxd answers out of range (-8) is asked for again by the poller, before anything is written for it, with nothing restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ace of the explorer's poll Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s chain as fluxd does getblock by height above the node's chain answers -8 "Block height out of range", and a handler's thrown RPC code reaches the caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a recovery recoverAndRestart counts each recovery it runs (explorer:recovery). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ied it whole Setup waits for both standbys to hold the stale files before the primary deletes them, and reads the other standby's sequence only once the directory is gone there and its folder is idle with nothing needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MorningLightMountain713
force-pushed
the
fix/explorer-waits-for-blocks
branch
from
November 26, 2026 07:21
0326c9b to
13f9dec
Compare
Collaborator
Author
|
Thanks for the review. The branch is rebased onto development, and the fix now sits in the explorer's step machine. Must-fix
Non-blocking
|
Cabecinha84
approved these changes
Nov 26, 2026
Cabecinha84
left a comment
Member
There was a problem hiding this comment.
ACK (code) at head 13f9dec, reviewed against current development tip 218f72d (the PR sits directly on it; MERGEABLE). This supersedes my earlier CHANGES_REQUESTED from 11-03.
Prior findings, re-verified
- Bootstrap hunk: gone.
- Catch-branch spin: fixed at both exits. A
-8fromgetblockand any other failure each waitPOLL_INTERVAL_MS, so poll -> block(h) ->-8-> wait -> poll is onegetblockper poll even if the cached sync height runs ahead of fluxd. -8scope: the check now wraps only thegetVerboseBlockfetch, before anything is written. A-8raised later goes to recovery with a DB restore, and a unit test covers it.- Test placement: now in
processBlock tests. It asserts the returned step andwaitMs, and suite 4005 asserts the recovery counter does not move. - PR body: rewritten and consistent with the diff.
Verified locally (scratch worktree at the head)
explorerService.test.js: 135 passing, 0 failing. ESLint clean on the changed JS files.- The 3 new unit tests fail with
development'sexplorerService.jsand pass with the PR's. error.codedoes reach the check:getVerboseBlockthrowsblockInfo.data, whichexecuteCallbuilds with the RPC code.- The stub's
-8applies only to numeric heights above the asking node's chain; hash lookups and callers with no source IP are unaffected.
Remaining, non-blocking
- I did not rerun the harness. The author's 343/343 gate at this head applies directly to the merge result, but re-running 4005 and 2268 before merge would be ideal.
- Release note: a non-
-8block failure now waits 5 s before the DB restore and retry (before: immediate). - Nit: the
-8path logs nothing. Leaving it out to avoid 5 s log spam is reasonable.
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.
Problem
A block that fails in
processBlockgoes to recovery with no wait, and recovery restores the explorer's database and asks for the same block again with no wait. The only brake is fluxd's sync state, which FluxOS reads from a cache that turns "not synced" only after fluxd has not answered for 300 s, or once its height is more than 5 blocks below the highest header seen. A block fluxd keeps refusing is therefore retried, with a database restore each time, as fast as fluxd answers:-8"Block height out of range"): 80–130 retries a second, until fluxd holds the block.Fix
-8) is asked for again by the poller afterPOLL_INTERVAL_MS. The check sits at thegetblockcall, before anything is written for the block, so there is nothing to restore; a-8raised later in the block goes to recovery.POLL_INTERVAL_MS, so a block fluxd keeps refusing is retried at the poll's pace (5 s in production).recoverAndRestartcounts each recovery it runs (explorer:recovery, read by the harness).getblockabove the asking node's chain with-8, as fluxd does, and passes a handler's RPC code through.Verification
tests/unit/explorerService.test.js: a-8fromgetblockreturns the poll step with nothing written; another error returns the recovery step afterPOLL_INTERVAL_MS; a-8raised after the block was fetched returns the recovery step.getblockfor one node: between two of the node's reads of fluxd's height the explorer asks at mostwindow / explorerPollIntervalMs + 1times, then processes the block once fluxd gives it. Without the fix:getblock asked 485 times in 4993ms against a poll of 833ms.-8branch:expected 10 to equal +0.rm: green with this setup; the setup that does not wait for both standbys fails test 2 withthe stranded copy gone.13f9deca97: 343 suites passed, 0 failed.🤖 Generated with Claude Code