README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it
Los mantenedores suelen responder en 2 días
@tanujb03 ya está trabajando en esto.
Desde el 10/10/2026.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- java
- Área
- documentation
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 0
- Forks
- 3
- Merge medio
- 2 d 5 h
- PR fusionados (30 d)
- 15
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de techcsispit/mini-chain
-
Blockchain.isValid() does not verify sender balance, allowing blocks with negative balances to pass validationPosiblemente ocupada @aadiitya2007 la tomó hace 4 días. Abiertobug good first issue
Dificultad 4/5 1-2 días Aptitud para principiantes 20/100
techcsispit/mini-chain#37 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de techcsispit/mini-chain
Issues similares
-
[Bug] 资源包列表 与 模组/数据包/世界 列表排列顺序不一致Posiblemente ocupada @fishdry1000 la tomó hace 4 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
AtlasOfLivingAustralia/species-lists#882 ·
Los mantenedores suelen responder en 1 día
-
Type/Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ballerina-platform/ballerina-library#9458 ·
Los mantenedores suelen responder en 1 día
-
UGS-FX 2.1.27 Open File IssueAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
winder/Universal-G-Code-Sender#3242 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PCL-Community/PCL-CE#3767 ·
Los mantenedores suelen responder en 1 día