Commit Graph

78 Commits

Author SHA1 Message Date
Matt Hess
76d1efcf57 Implement batch block transfer with server side ancestor fill, BLOCK_BATCH_MAX_COUNT reduced from 50 to 10 to avoid contention warnings, fix get_seed failure in add_external_block returning false 2026-02-19 20:30:23 +00:00
Matt Hess
5d196ade1f Enhance mainchain reorg handling with mining pause and robust recovery 2026-01-14 18:31:37 +00:00
Matt Hess
67573992d2 Tune checkpoint interval to 100 blocks for better prune alignment 2026-01-12 20:11:01 +00:00
Matt Hess
67200d8457 Fix deadlock when trigger_recovery() called while holding sidechain lock, Add mainchain_height to checkpoints for smarter rollback during reorgs, Resume mining immediately after reset (network rebuilds via mining, not sync), Increase checkpoint history from 20 to 50 for deeper reorg coverage 2026-01-12 17:22:21 +00:00
Matt Hess
5e5fef537e Fix up chain resync deadlock during cascade failure 2026-01-12 16:19:52 +00:00
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
4a2bec3f29 Add sync mode to prevent mining during sidechain load
- Added m_readyToMine flag to SideChain
- Display LOADING SIDECHAIN banner at startup
- Delay stratum server and mining until sidechain sync completes
- Display MINING IS NOW ENABLED when ready
- Prevents premature mining that caused peer bans and chain splits

P2PServer starts immediately for sync, but stratum port doesn't
open until sidechain is fully loaded and after pruning completes
2025-12-09 18:52:32 +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
Matt Hess
ec4f5d914d Removed --donate-time CLI option and donatetime console command, Removed time-based donation tracking, Replace time-based donation with deterministic blockchain-height-based donation, All nodes calculate donation mode identically based on block height, Eliminated need for sidechain file on mainnet - defualts to salvium_main now 2025-11-17 04:10:38 +00:00
SChernykh
801c131172 P2P: save/load onion peers, added onion seed nodes 2025-10-20 19:07:29 +02:00
SChernykh
cb9fc89b22 Added --onion-address command line option to support incoming TOR connections 2025-10-20 13:06:45 +02:00
SChernykh
6b4c39f4c9 SideChain: added some extra checks, removed const_cast 2025-10-01 18:05:26 +02:00
SChernykh
e1da9ff4d3 Fixed cppcheck errors 2025-10-01 16:39:42 +02:00
SChernykh
964f4c8065 Updated copyright 2025-07-14 20:30:33 +02:00
SChernykh
e69f5722df CI: use clang-20 for code coverage 2025-06-22 17:22:35 +02:00
SChernykh
e0c1d9377c P2Pool-nano support 2025-05-28 15:04:11 +02: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
031a1c2eea SideChain: more fine-grained locks 2024-10-29 12:36:39 +01:00
SChernykh
ec15417fd2 More C++17 2024-01-05 14:36:35 +01:00
SChernykh
f95d366881 Merge branch 'master' into merge-mining 2024-01-02 14:26:32 +01:00
SChernykh
1e1c3ad6e9 Updated copyright 2024-01-02 14:12:16 +01:00
SChernykh
3c510598fa Better type checking for Merkle root hashes 2023-12-23 10:17:49 +01:00
SChernykh
ae233bbf0b Fixed BLOCK_FOUND detection 2023-12-22 11:50:08 +01:00
SChernykh
ec35c74e5f Init merge mining tag properly 2023-10-25 00:14:09 +02:00
SChernykh
4e55f53fb4 Notify about new P2Pool versions 2023-10-08 18:52:06 +02:00
SChernykh
32dc235aa5 SideChain: fix for out of order blocks 2023-07-12 00:25:37 +02:00
SChernykh
a7f66c8883 SideChain: filter duplicates from missing blocks 2023-07-10 14:11:22 +02:00
SChernykh
fe2ff95f19 P2PServer: use BLOCK_NOTIFY to speed up syncing 2023-07-07 16:48:28 +02:00
SChernykh
b5fa34e1a1 Added support for multiple Monero hosts
Switch to the next host in list when P2Pool thinks current host is stuck or lagging
2023-06-18 12:56:27 +02:00
SChernykh
9d6f232dd1 Tweaked block_seen logic 2023-05-29 14:13:11 +02:00
SChernykh
eab8a51bb7 SideChain: tweaked m_seenBlocks cleanup logic 2023-05-22 15:30:57 +02:00
SChernykh
6a4583f758 Sync test: keep running for 2 minutes more 2023-05-18 00:28:49 +02:00
SChernykh
f6a285de87 API: added PPLNS window size to pool stats 2023-03-28 13:53:52 +02:00
SChernykh
1b5860eec8 Fixed cppcheck errors 2023-03-06 14:52:47 +01:00
SChernykh
f206e4b334 Testnet fork on January 21st 2023-01-16 15:36:21 +01:00
SChernykh
14f667de74 Support dynamic PPLNS window in status 2023-01-13 17:43:56 +01:00
SChernykh
4f2ad9a93c Optimized get_shares 2023-01-10 22:17:17 +01:00
SChernykh
47f551c046 Randomize output order for P2Pool payouts 2023-01-09 20:07:11 +01:00
SChernykh
11e4c459c9 pub/sec tx key cleanup 2023-01-09 01:15:06 +01:00
SChernykh
4f34c4466a Dynamic PPLNS window 2023-01-08 00:47:03 +01:00
SChernykh
ccc5117172 Track shares that failed to be added 2023-01-07 15:50:02 +01: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
e6d77a40e2 Check block major version in deserialize() 2022-12-19 10:29:29 +01:00
SChernykh
488ed8e562 Added more 128 bit calculations 2022-11-16 10:36:46 +01:00
SChernykh
255d312ae0 SideChain: log blocks with the same id 2022-11-02 12:49:12 +01:00
SChernykh
afa9cf371e P2PServer: sync from the fastest peer if possible 2022-09-13 10:51:15 +02:00
SChernykh
bde5b19c77 CI: added sync test 2022-08-23 19:49:41 +02:00
SChernykh
30861bbf91 Speedup SideChain::get_outputs_blob() 2022-08-15 13:48:21 +02:00
SChernykh
02a8a512dc SideChain: precalculate tx pubkeys for faster sync 2022-07-14 10:28:25 +02:00