Repository navigation
fix: accept chaininfo warnings in any JSON shape - #57
Merged
setavenger merged 1 commit intoSep 23, 2026
Merged
Conversation
Initial sync fails immediately on Bitcoin Core v28+ with
initial sync failed: json: cannot unmarshal array into Go struct
field ChainInfo.warnings of type string
because Core v28 changed the `warnings` field of chaininfo from a
string to an array of strings (the `-deprecatedrpc=warnings` escape
hatch was removed again in v29, so every version this project's README
supports, v30+, returns the array). Verified live against Core v31.1:
`/rest/chaininfo.json` returns `"warnings": []`.
This field has already flipped once: the struct originally declared
`[]string`, setavenger#53 changed it to `string` (fixing setavenger#50), and the follow-up
comments on setavenger#50 then showed v31 answering with an array again. Declaring
it as `json.RawMessage` accepts both shapes, so this class of breakage
ends here. Nothing in the oracle reads the field, so no behavior
changes.
Tested: mainnet initial sync from height 709656 runs on Core v31.1 with
this patch (250k+ blocks indexed at the time of writing).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
ACK 039fc5b tested on Core v31.1 |
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.
Initial sync fails immediately on Bitcoin Core v28+ with
because Core v28 changed the
warningsfield of chaininfo from a string to an array of strings (the-deprecatedrpc=warningsescape hatch was removed again in v29, so every version this project's README supports, v30+, returns the array). Verified live against Core v31.1:/rest/chaininfo.jsonreturns"warnings": [].This field has already flipped once: the struct originally declared
[]string, #53 changed it tostring(fixing #50), and the follow-up comments on #50 then showed v31 answering with an array again. Declaring it asjson.RawMessageaccepts both shapes, so this class of breakage ends here. Nothing in the oracle reads the field, so no behavior changes.Tested: mainnet initial sync from height 709656 runs on Core v31.1 with this patch (250k+ blocks indexed at the time of writing).