fix: decode block header fields from Core JSON - #2
Open
tolga-tom-nook wants to merge 2 commits into
Open
Conversation
Bitgesell Core returns getblockheader bits as a compact hex string and previous/next block hashes as lower-case JSON keys. Decode those fields correctly and add a regression test for the public RPC response shape.
This was referenced May 25, 2026
|
Maintainers: diff-only review-assist for Bitgesell improvement lane This PR looks narrow and reviewer-friendly from the public diff:
Suggested acceptance checks:
From a bounty-review perspective, this seems to fit the issue's "small, concrete API/test correctness fix" lane better than a docs-only cleanup. If merged, it would help to route payout review back through |
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
getblockheaderbitsas the compact hex string returned by the RPC API.previousblockhash/nextblockhashJSON tags so lower-case Core response keys populate the struct.getblockheaderresponse.net/urlinstead of brittle string splitting.Compatibility note
BlockHeader.Bitsintentionally changes fromuint32tostring. Bitgesell/Bitcoin Core RPC returnsbitsas a compact target hex string such as"1d00ffff", and this also matches the existingBlock.Bits stringshape in this package.Validation
go test ./...fails before the fix becauseBlockHeader.Bitsisuint32while Core returns"1d00ffff".go test ./...passes.go version=>go1.22.2 linux/amd64;go test ./...passes;git diff --checkclean.Bounty context
Submitted for the Bitgesell improvement PR bounty:
Payout rail if approved: USDT/EVM-compatible
0x4a76c7E64C08cF29B59eFC640b4ada97A270d428.