Commit graph

16 commits

Author SHA1 Message Date
Claude
3fe3b558d7
test(chain): verify ring signatures during full chain sync
All pre-HF4 spending transactions on testnet pass NLSAG ring
signature verification end-to-end.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:58:29 +00:00
Claude
37a70c0ff1
feat(chain): add sparse chain history builder for P2P sync
Implements get_short_chain_history() algorithm: recent 10 block hashes
then exponentially-spaced hashes back to genesis.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:56:41 +00:00
Claude
0e35c2996d
refactor(chain): extract processBlockBlobs for shared RPC/P2P use
The block processing logic is now in processBlockBlobs() which takes
raw wire bytes. The RPC processBlock() becomes a thin hex-decode
wrapper. The P2P sync path will call processBlockBlobs() directly.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:50:36 +00:00
Claude
c395c2ff18
test(chain): add full sync-to-tip integration test
Syncs the entire testnet chain via RPC and verifies every block
decodes, validates, and stores correctly.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:47:01 +00:00
Claude
53311b14d1
fix(chain): resolve missing block blobs from daemon RPC
The Zano daemon's get_blocks_details RPC does not populate the blob
field. This adds resolveBlockBlobs() which batch-fetches miner tx
blobs via /gettransactions and reconstructs block wire blobs from
the parsed header (object_in_json AGGREGATED section) and raw tx
bytes. Also fixes regular tx processing to skip the miner tx entry
that the daemon includes in transactions_details.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:46:56 +00:00
Claude
ad4139c012
fix(chain): mark ZC input key images as spent during sync
TxInputZC (v2+) inputs have key images that must be tracked for
double-spend detection, same as TxInputToKey.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:36:00 +00:00
Claude
c066f4ac92
feat(chain): add context cancellation and progress logging to Sync
Sync() now accepts context.Context for graceful shutdown. Logs progress
every 100 blocks.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:33:08 +00:00
Claude
4bac1f6c04
feat(chain): add GetRingOutputs callback for signature verification
Implements consensus.RingOutputsFn by looking up output public keys from
the chain's global output index and transaction store. Wired into the
sync loop so VerifySignatures=true uses real crypto verification.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 20:28:54 +00:00
Claude
112da0e123
feat(chain): integrate consensus validation into sync
Add SyncOptions with VerifySignatures flag and hardfork schedule.
ValidateMinerTx and ValidateTransaction called during block processing.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 01:11:33 +00:00
Claude
28e3da63cb
test(chain): boost coverage to >80% with multi-block sync and error paths
Add comprehensive tests exercising regular transaction processing through
the sync pipeline (key image marking, output indexing, cumulative
difficulty) and not-found error paths for all query methods. Coverage
rises from 65.8% to 80.1%.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 22:02:10 +00:00
Claude
ef4edd669a
test(chain): integration test syncing first 10 blocks from testnet
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:55:19 +00:00
Claude
23d337e397
feat(chain): RPC sync loop with block processing and indexing
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:53:49 +00:00
Claude
f5822e7222
feat(chain): block header validation (linkage, height, size)
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:50:12 +00:00
Claude
89f5f0ebdf
feat(chain): transaction, key image, and output index operations
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:49:15 +00:00
Claude
d5976d33c3
feat(chain): Chain struct with block storage and retrieval
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:44:57 +00:00
Claude
8cb5cb4ad2
feat(chain): go-store dependency and metadata types
Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 21:42:22 +00:00