README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it
I maintainer di solito rispondono entro 2 giorni
@tanujb03 ci sta già lavorando.
Dal 10/10/2026.
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
What I did
- Fresh checkout of
main(0e92205), JDK 17, Maven 3.9. mvn compile exec:java, then in the menu:2(mine a block, nameasha),1(asha pays ravi 10),8(quit). This writeschain.dat.- Followed the README sentence literally and changed
Block: addedprivate String note = "added";underprivate String hash;inBlock.java. Thenmvn compile exec:javaagain. - Repeated from a fresh
chain.datwith other changes:- added a method
public String memo() { return "changed"; }toTransaction - changed
private static final long serialVersionUID = 2L;to3LinBlock - changed the same line to
3LinTransaction - changed
private int noncetoprivate long nonceinBlock
- added a method
What I expected
The README, "Saving" section, says:
It is tied to the
BlockandTransactionclasses. 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di techcsispit/mini-chain
-
Blockchain.isValid() does not verify sender balance, allowing blocks with negative balances to pass validationForse già presa @aadiitya2007 l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 20/100
techcsispit/mini-chain#37 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Blockchain: a payment that was already mined can be submitted again, and it is accepted and mined a second timeForse già presa @aadiitya2007 l’ha presa 3 giorni fa. Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
techcsispit/mini-chain#16 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di techcsispit/mini-chain
Issue simili
-
dev/release: verify-release-candidate.sh runs 0 Java tests with Debian's MavenForse già presa @kou l’ha presa oggi. ApertaType: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/arrow-adbc#4947 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
lysine-dev/okhttp#9814 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
1.20.1-FORGE bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
MehVahdJukaar/WoodGood#1348 ·
-
documentation faq
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100