Skip to content

Bound the block target to one week of blocks - #14

Merged
sanket1729 merged 1 commit into
mainfrom
sanketk/bound-numofblocks
Aug 5, 2026
Merged

Bound the block target to one week of blocks#14
sanket1729 merged 1 commit into
mainfrom
sanketk/bound-numofblocks

Conversation

@sanket1729

Copy link
Copy Markdown
Contributor

Simulation cost grows with the block target, and neither numOfBlocks nor the blockTargets constructor list had an upper bound — a target of 1,000,000 spends about two minutes of CPU in a single call. bitcoin-augur-server passes an HTTP query parameter straight into numOfBlocks, so one unauthenticated request can saturate a core.

Rejects targets above MAX_BLOCK_TARGET (1008).

Simulation cost grows with the block target: getExpectedBlocksMined evaluates a
Poisson tail of 4 * target entries and then simulates that many blocks, so a
target of 1_000_000 spends roughly two minutes of CPU. Neither the numOfBlocks
argument nor the blockTargets constructor list had an upper bound, and
bitcoin-augur-server passes an HTTP query parameter straight into numOfBlocks,
so one unauthenticated request can saturate a core.

Reject targets above MAX_BLOCK_TARGET, one week of blocks.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@sanket1729
sanket1729 marked this pull request as ready for review August 5, 2026 19:44

@laurenshareshian laurenshareshian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sanket1729
sanket1729 merged commit 6f29f6a into main Aug 5, 2026
10 checks passed
@sanket1729
sanket1729 deleted the sanketk/bound-numofblocks branch August 5, 2026 20:23
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.

3 participants