Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Tests: no test covers a payment of 0 or the genesis block meeting the difficulty

Open Beginner friendly
#23 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@tanujb03 is already working on this.

Since Oct 10, 2026.

  • #24 by @tanujb03 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

The two rules are in the README's "How it's supposed to work" section, and the code they describe is in Blockchain.java. Start by running mvn -B test and reading BlockchainTest, where blocksAreMinedAndLinked and startsWithGenesisBlock sit. Done means one new test file with a test that a zero-amount payment is rejected and a test that the genesis block's hash starts with the difficulty's zeros, and both fail when the mutations in the issue table are applied locally.

Written by the indexing model from the issue text.

Description

Two sentences in the README's "How it's supposed to work" section have no test that would fail if the code stopped following them.

Missing coverage

  1. The amount has to be more than 0.

    BlockchainTest.cannotMakeNegativePayment only tries -10. The boundary value 0 is never tried. The menu does reject it today ("Payment amount must be greater than zero."), but nothing would notice if it stopped.

  2. Every block's hash starts with as many zeros as the difficulty.

    blocksAreMinedAndLinked checks the zeros in a loop that starts at i = 1, and startsWithGenesisBlock only checks getPreviousHash(). The genesis block (block 0) is never checked.

Evidence

Checked on main @ 0e92205, JDK 17.0.12, Maven 3.9.16, by changing the code locally and running mvn -B test:

Local change to Blockchain.java Result
tx.amount() <= 0 changed to tx.amount() < 0 (a 0 payment is accepted) all 18 tests still pass
genesis.mine(difficulty); removed from the constructor (genesis is not mined) all 18 tests still pass

Planned change

Add one new test file with one test for each rule. Tests only, no production code changes.

I'd like to work on this.

Dominant language
Java
Stars
0
Forks
3
Avg merge
16h 38m
Merged PRs (30d)
7

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from techcsispit/mini-chain

All issues in techcsispit/mini-chain

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.