Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#23 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@tanujb03 ci sta già lavorando.

Dal 10/10/2026.

  • #24 di @tanujb03 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Le due regole si trovano nella sezione "How it's supposed to work" del README, e il codice che descrivono è in Blockchain.java. Inizia eseguendo mvn -B test e leggi BlockchainTest, dove si trovano blocksAreMinedAndLinked e startsWithGenesisBlock. Il lavoro è completo quando esiste un nuovo file di test con un test che verifica che un pagamento di importo zero venga rifiutato e un test che verifica che l'hash del blocco genesis inizi con gli zeri della difficoltà, e quando entrambi falliscono applicando localmente le mutazioni della tabella nell'issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
0
Fork
3
Merge medio
16h 38m
PR unite (30g)
7

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di techcsispit/mini-chain

Tutte le issue di techcsispit/mini-chain

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.