Commit Graph

28 Commits

Author SHA1 Message Date
Matt Hess 11b545e91b Add CAP exchange protocol, Deadlock fix, Sync stuck fix with retry mechanism 2025-12-17 00:29:41 +00:00
Matt Hess 940f1cabe8 Revert "Remove compact/pruned blob code - it displeases the carrot"
This reverts commit d5a8bbcc4a.
2025-12-11 02:26:30 +00:00
Matt Hess d5a8bbcc4a Remove compact/pruned blob code - it displeases the carrot 2025-12-10 15:56:49 +00:00
Matt Hess 00fb078004 Implement genesis reconciliation protocol for sidechain stability
Problem: P2Pool nodes starting at different times or experiencing network
issues would create independent genesis blocks, resulting in incompatible
chains. Nodes would ban each other for invalid blocks that were actually
valid on a different chain. Cache resume after restart frequently failed
due to genesis mismatch between nodes.

Solution:  Oldest compatible genesis wins protocol that coordinates
genesis selection across peers before mining begins.

New P2P message GENESIS_INFO exchanges:
- Genesis block hash
- Genesis timestamp
- Genesis mainchain height
- Protocol version

Startup behavior:
- Wait up to 90 seconds for peer genesis info (with progress logging)
- Adopt oldest genesis from compatible peers
- Only create own genesis if no peers respond

Late joiner reconciliation:
- Running nodes that receive older genesis from new peer will purge
  their sidechain and re-sync to the older chain
- Cache files deleted on purge to prevent reload of stale blocks

Protocol versioning:
- PROTOCOL_VERSION constant at top of side_chain.h
- Increment only on consensus-breaking changes
- Version mismatch logs warning, prevents genesis adoption

Tiebreaker: When timestamps match, lexicographically lower hash wins.
2025-12-05 23:44:53 +00:00
SChernykh 0184a3139c CI: revised clang-tidy list of checks 2025-09-25 18:46:22 +02:00
SChernykh 964f4c8065 Updated copyright 2025-07-14 20:30:33 +02:00
SChernykh 921611ff4d Added --data-dir command line option 2024-12-04 15:39:19 +01:00
SChernykh fd0a7ea0c7 Faster initial sync
0.5-1 seconds saved on verification after removing the repeated `get_shares` calls
2024-11-22 18:42:51 +01:00
SChernykh bbddf40590 Fixed cppcheck error 2024-04-25 14:48:34 +02:00
SChernykh 1e1c3ad6e9 Updated copyright 2024-01-02 14:12:16 +01:00
SChernykh 76c4573c39 CI: cleanup build warnings
Tests: fixed "unused const variable" warning
CMakeLists.txt: fixed deprecation warnings
2023-08-16 14:20:23 +02:00
SChernykh f6cc7abac9 Fixed cppcheck error 2023-04-05 14:13:48 +02:00
SChernykh b346b93285 Updated copyright 2023-01-04 13:07:55 +01:00
SChernykh dffc8bcea0 Fixed cppcheck issues 2022-12-22 14:08:49 +01:00
SChernykh 47ff7e228e Added code to deserialize compact blobs 2022-11-09 16:21:31 +01:00
SChernykh eabf856dbd Removed redundant m_sideChainData 2022-10-04 15:49:58 +02:00
SChernykh 6a66615f37 Removed redundant m_mainChainData 2022-10-03 18:42:32 +02:00
SChernykh 30861bbf91 Speedup SideChain::get_outputs_blob() 2022-08-15 13:48:21 +02:00
SChernykh a2afa29052 Updated copyright 2022-03-30 14:42:26 +02:00
SChernykh 8b27faad6d BlockCache: fixed collisions of same height blocks 2022-03-24 16:03:12 +01:00
SChernykh afca83d6c2 BlockCache: check block size before storing it 2021-08-27 10:37:14 +02:00
SChernykh 715c0d4e14 Reduced cache size a bit 2021-08-27 10:12:41 +02:00
SChernykh d246ee1552 Enabled block cache for Mac 2021-08-25 16:26:15 +02:00
SChernykh cd532965e8 Code safety: BlockCache isn't supposed to be copied/moved 2021-08-24 21:06:47 +02:00
SChernykh 4837b4c863 Added missing integrity check 2021-08-24 13:33:55 +02:00
SChernykh 05d336c8e9 Update block_cache.cpp 2021-08-24 12:45:11 +02:00
SChernykh 1cf4071f9b BlockCache (Linux version) 2021-08-24 12:36:59 +02:00
SChernykh aba3bc50b8 Block cache WIP and other fixes
- Block cache is implemented only on Windows for now
- Tracking of background jobs
- More robust sidechain syncing
2021-08-24 11:42:41 +02:00