Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#21 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@tanujb03 đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #22 của @tanujb03 — đang mở
  • #26 của @YuuGR1337 — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
documentation

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
0
Fork
3
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của techcsispit/mini-chain

Tất cả issue của techcsispit/mini-chain

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.