Skip to content

fix(spv): allow proofs longer than 144 headers#4164

Open
mswilkison wants to merge 3 commits into
stack/pr-4039-basefrom
fix/spv-long-proof-headers
Open

fix(spv): allow proofs longer than 144 headers#4164
mswilkison wants to merge 3 commits into
stack/pr-4039-basefrom
fix/spv-long-proof-headers

Conversation

@mswilkison

@mswilkison mswilkison commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove the client-only 144-header cap from the SPV proof walk
  • keep walking through mined headers until the proof has enough work or reaches the Bitcoin chain tip
  • skip only headers whose decoded target exactly matches the Bridge DIFF1 target
  • reject non-positive header targets before calculating difficulty

Regression coverage

  • 144 DIFF1 headers followed by a decisive difficulty-16 header
  • non-DIFF1 bits 0x1d00aaaa, whose integer difficulty rounds to one, remain decisive
  • zero-target compact bits return a proof error instead of panicking

Testing

  • go test -count=1 ./pkg/maintainer/spv
  • go test ./pkg/maintainer/...

Stacked on #4039. The temporary base branch mirrors #4039 at 832c116; retarget this PR to main after #4039 merges.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 42f2abe5-2374-439b-b6a2-55bbb4f0b4d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/spv-long-proof-headers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant