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

README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it

Aperta
#21 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@tanujb03 ci sta già lavorando.

Dal 10/10/2026.

  • #22 di @tanujb03 — aperta
  • #26 di @YuuGR1337 — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
25/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
java
Ambito
documentation

Direzione di ricerca

The sentence to change is in the README's "Saving" section, which says changing Block or Transaction stops chain.dat from loading. Compare it with the version-comment in Block.java and Transaction.java and with the fallback in Storage.load, which together show that only incompatible serialization changes stop loading. Done means the README says added fields or methods still load and gives one example that does stop loading. A linked pull request (#22) already exists, so check it before starting.

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

Descrizione

documentation good first issue

What I did

  1. Fresh checkout of main (0e92205), JDK 17, Maven 3.9.
  2. mvn compile exec:java, then in the menu: 2 (mine a block, name asha), 1 (asha pays ravi 10), 8 (quit). This writes chain.dat.
  3. Followed the README sentence literally and changed Block: added private String note = "added"; under private String hash; in Block.java. Then mvn compile exec:java again.
  4. Repeated from a fresh chain.dat with other changes:
    • added a method public String memo() { return "changed"; } to Transaction
    • changed private static final long serialVersionUID = 2L; to 3L in Block
    • changed the same line to 3L in Transaction
    • changed private int nonce to private long nonce in Block

What I expected
The README, "Saving" section, says:

It is tied to the Block and Transaction classes. Change either one and the file stops loading, and the program starts a new chain instead.

So after any change to Block or Transaction, the program should start a new chain.

What happened instead

Change What the program printed
add a field to Block Loaded chain.dat. (old chain, queued payment and balances intact)
add a method to Transaction Loaded chain.dat.
serialVersionUID 2L to 3L in Block Couldn't read chain.dat (InvalidClassException), so a new chain was started.
serialVersionUID 2L to 3L in Transaction Loaded chain.dat.
nonce int to long in Block Couldn't read chain.dat (InvalidClassException), so a new chain was started.

So the file stops loading only for changes Java serialization treats as incompatible. This looks intended: Block.java and Transaction.java carry the comment // bump version only for incompatible changes, adding a field is safe, and Storage.load falls back to a new chain when it can't read the file. The README sentence is the part that is too broad.

I'd like to fix the README wording only (no code change), so that it says adding a field or method still loads, and gives an example of a change that does make the file stop loading.

Environment
main @ 0e92205, JDK 17.0.12, Maven 3.9.16, Windows 11.

Lingua principale
Java
Stelle
0
Fork
3
Merge medio
1g 18h
PR unite (30g)
14

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.