Fix silently-broken block height and fee stats (mempool.space HTTP redirect) - #44
Open
BurtonJeff wants to merge 1 commit into
Open
Fix silently-broken block height and fee stats (mempool.space HTTP redirect)#44BurtonJeff wants to merge 1 commit into
BurtonJeff wants to merge 1 commit into
Conversation
mempool.space 301-redirects HTTP to HTTPS and HTTPClient does not follow redirects, so the "HTTP API - always works" block-height and fee fetches have in fact never worked: both failed silently on every boot and the screen showed "---"/0 forever. - Point both endpoints at https:// and route them through the shared fetchJson() path, which picks proxy or direct HTTPS per config. The block-height endpoint returns a bare number, which is a valid JSON document, so it parses through the same path. - updateNetworkHashrate() is proxy-only (it opens a raw socket to the proxy host) but its guard allowed direct-HTTPS mode through, causing a connect to an empty hostname and repeated "[E] hostByName(): DNS Failed for" log spam. Require a healthy proxy instead. Note: with HTTPS disabled (the current default), height and fees now skip cleanly rather than fail noisily - they were never being fetched anyway. Enabling direct HTTPS is stable once the SHA engine collision is fixed (see companion PR).
jmarquez84
pushed a commit
to jmarquez84/SparkMiner
that referenced
this pull request
Jul 22, 2026
…TPS (fixes 0 values)
jmarquez84
added a commit
to jmarquez84/SparkMiner
that referenced
this pull request
Jul 22, 2026
…TPS (fixes 0 values)
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.
Symptoms
Block height and fees show
---/0forever, on every board, regardless of config. The code comments say "HTTP API - always works", but these two fetches have never returned data.Root cause
mempool.space 301-redirects HTTP to HTTPS, and
HTTPClientdoesn't follow redirects — so the plain-HTTPfetchHttp()/raw-client paths get the redirect page's status and fail silently on every call.Separately,
updateNetworkHashrate()is proxy-only (it opens a raw socket to the proxy host), but its guard let direct-HTTPS mode fall through toclient.connect(s_proxyHost, ...)with an empty hostname, producing repeated[E] hostByName(): DNS Failed forlog spam.Fix
API_BLOCK_HEIGHTandAPI_FEESathttps://and route both through the sharedfetchJson()path, which selects proxy or direct HTTPS per config. The block-height endpoint returns a bare number, which is a valid JSON document, so it parses through the same path —updateBlockHeight()loses its bespoke raw-client code.updateNetworkHashrate().Behavior notes
With HTTPS disabled (the current default) these stats now skip cleanly instead of failing noisily — they were never being fetched anyway, so nothing regresses. With a proxy or direct HTTPS enabled, height and fees populate for the first time. Direct HTTPS itself is made stable by #43 (the SHA engine collision fix) — the two PRs are independent to merge but complementary in effect.
Verified on an ESP32-2432S028R with direct HTTPS enabled: height and fee values populate within the first stats cycle and refresh on schedule.
🤖 Generated with Claude Code