Commit graph

7 commits

Author SHA1 Message Date
Virgil
96d60484b6 fix(blockchain): upgrade to core v0.8.0-alpha.1 + replace banned imports
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 14:10:18 +00:00
Snider
34128d8e98 refactor: migrate module path to dappco.re/go/core/blockchain
Some checks failed
Security Scan / security (pull_request) Successful in 11s
Test / Test (pull_request) Failing after 19s
Update go.mod module line, all require/replace directives, and every
.go import path from forge.lthn.ai/core/go-blockchain to
dappco.re/go/core/blockchain. Add replace directives to bridge
dappco.re paths to existing forge.lthn.ai registry during migration.
Update CLAUDE.md, README, and docs to reflect the new module path.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:49:26 +00:00
Snider
71f0a5c1d5 refactor: replace fmt.Errorf/os.* with go-io/go-log conventions
Some checks failed
Security Scan / security (push) Successful in 11s
Test / Test (push) Failing after 23s
Replace all fmt.Errorf and errors.New in production code with
coreerr.E("Caller.Method", "message", err) from go-log. Replace
os.MkdirAll with coreio.Local.EnsureDir from go-io. Sentinel errors
(consensus/errors.go, wire/varint.go) intentionally kept as errors.New
for errors.Is compatibility.

270 error call sites converted across 38 files. Test files untouched.
crypto/ directory (CGO) untouched.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 21:17:49 +00:00
Claude
3c76dd7070
fix(difficulty): correct LWMA algorithm and hardfork-aware target
Rewrites the LWMA difficulty algorithm to match the C++ daemon exactly:
- Uses N=60 window with linear weighting (position 1..n)
- Clamps solve times to [-6T, 6T]
- Excludes genesis block from the difficulty window
- Selects target based on hardfork: 120s pre-HF2, 240s post-HF2

On testnet, HF2 activates at height 10 (active from height 11),
doubling the target from 120s to 240s. The previous fixed 120s target
produced exactly half the expected difficulty from height 11 onward.

Integration test verifies all 2576 testnet blocks match the daemon.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 22:32:57 +00:00
Claude
ff8f300601
feat(chain): compute difficulty locally during P2P sync
P2PSync now calls NextDifficulty() for each block instead of
hardcoding difficulty=0.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 22:04:49 +00:00
Claude
c6504276dc
fix(chain): skip overlap block in P2P sync chain entries
RESPONSE_CHAIN_ENTRY includes the fork-point block as its first
entry. The sync loop now skips blocks already stored to avoid
height validation failures on subsequent chain iterations.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 21:31:59 +00:00
Claude
d588f8f8d0
feat(chain): add P2P sync state machine
P2PSync() runs the REQUEST_CHAIN / REQUEST_GET_OBJECTS loop against
a P2PConnection interface. Reuses processBlockBlobs() for shared
validation logic.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 21:00:57 +00:00