Commit Graph

72 Commits

Author SHA1 Message Date
Matt Hess 248bb7fe6a Fix log.h static_assert error 2025-12-20 06:35:17 +00:00
Matt Hess 04d5d3634b Fix Windows MSVC compilation and cppcheck warnings, code struct triggers padding warnings 2025-12-19 20:57:48 +00:00
Matt Hess 9266f28d22 fix one critical bug and mostly code quality/cleanup items for portability, minor cleanup for compile on mac, fixed null check, Remove redundant TX_VERSION check 2025-12-17 22:53:56 +00:00
Matt Hess 0a7d287c40 Moved verbose DEBUG and diagnostic logging from level 0 to level 6 to reduce console spam during normal operation 2025-12-08 23:56:25 +00:00
Matt Hess 728d6c2cbf Fix Carrot v1 protocol TX handling for peer synchronization
Root cause: Merkle verification failures (error 659) and peer bans occurred
because protocol TX was not consistently present in m_transactions[1].

Parser fix (pool_block_parser.inl):
- Skip dummy transactions[0] entry when populating m_transactions
- Add protocol TX computation after parsing for Carrot v1 blocks

Block template fix (block_template.cpp):
- Insert protocol TX at position [1] during block creation in update()
- Insert protocol TX during select_mempool_transactions()

get_pow_hash fix (pool_block.cpp):
- Ensure protocol TX is populated before serialize_mainchain_data()

The protocol TX must be at m_transactions[1] before ANY serialization
occurs, otherwise sender and receiver compute different merkle roots.

Tested: Multiple restart cycles with two nodes, no bans, chains stay synced.
2025-12-07 23:57:46 +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 a5ee896215 Fix Carrot v1 onetime address computation 2025-11-27 05:41:17 +00:00
Matt Hess 735eb6737f fixed communication issue with tx version relay 2025-11-16 21:01:21 +00:00
Matt Hess f22456d916 fixed miner_tx and proto_tx 2025-11-16 14:01:17 +00:00
Matt Hess e8c7b703f3 fixing block template submittal for protocol_tx 2025-11-16 02:18:09 +00:00
Matt Hess b69fd42df8 Updated p2pool to fix submitted block format 2025-11-16 00:46:29 +00:00
Matt Hess 6a21f04600 Revert "Fix dev fee implementation for peer synchronization"
This reverts commit 8ff12ad180.
2025-11-13 04:59:00 +00:00
Matt Hess 8ff12ad180 Fix dev fee implementation for peer synchronization
- Add dev fee output in get_outputs_blob() for sidechain validation
- Fix extra nonce size calculation to account for dev fee weight
- Fix size estimation in busy mempool handler to account for dev fee
- Add debug logging for mainchain data serialization
- Fixes peer banning due to sidechain ID mismatch (error 502)
2025-11-12 22:26:47 +00:00
SChernykh e2f0ec7c69 De-duplicate tx hashes and pub keys to save memory (off by default) (#382)
P2Pool-main: 8.2 MB saved
P2Pool-mini: 66 MB saved
P2Pool-nano: 25.2 MB saved

The feature is available only when building from source and is intended for use on low-memory systems (for example, a VPS server with < 1 GB RAM).

It only makes sense to use with `--no-cache --no-randomx` in the command line because cache and RandomX hasher take much more memory.
2025-10-18 12:21:16 +02:00
SChernykh 741aaf95a8 Removed old fork code 2025-10-04 12:41:35 +02:00
sech1 50634e5e79 Feature: broadcast all new Monero blocks through p2pool network for faster propagation 2025-09-03 10:07:39 +02:00
SChernykh 964f4c8065 Updated copyright 2025-07-14 20:30:33 +02:00
SChernykh 1b863109f9 CI: more tests 2025-06-22 23:18:36 +02:00
SChernykh 70298cd065 Merge mining donation support 2025-05-13 17:18:29 +02:00
SChernykh 2a30901ba5 Added comments to PoolBlock::get_pow_hash
To explain what looks like a random magic code there
2025-05-07 16:21:27 +02:00
SChernykh fb8e2a71e0 Fixed global init/shutdown order 2024-12-04 14:30:20 +01:00
SChernykh 1029faa02f Refactor PoolBlock's lock code 2024-11-23 13:20:47 +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 1053e22a52 Removed hardfork code 2024-10-13 14:17:37 +02:00
SChernykh c88f126cb1 Updated tests post-fork 2024-10-13 13:13:14 +02:00
SChernykh 5b3c1d749c Added merge mining extra
For future merge mining needs
2024-06-16 22:42:22 +02:00
SChernykh b92eedeed7 Set testnet fork time 2024-06-05 19:08:14 +02:00
SChernykh 899a908409 Added hardfork code 2024-05-14 22:48:59 +02:00
SChernykh f67009f133 Added path bitmap to get_merkle_proof 2024-05-10 15:34:30 +02: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 658d756120 Fixed Merkle proof generation for aux chains 2023-12-10 19:24:05 +01:00
SChernykh 13087dd45e Submit found aux blocks 2023-11-20 22:22:37 +01:00
SChernykh 0b711cbe65 Init and update merkle tree root 2023-10-25 20:06:12 +02:00
SChernykh 2d1158af64 Store Merkle tree root in the merge mining tag 2023-10-25 15:49:25 +02:00
SChernykh ec35c74e5f Init merge mining tag properly 2023-10-25 00:14:09 +02:00
SChernykh b46da74c2c Moved out merkle tree hash code 2023-10-21 19:04:17 +02: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 bb80fe12a0 Added a check for unstable hardware 2023-03-28 10:27:27 +02:00
SChernykh b6c1b1a6d7 P2PServer: log time it took to relay a block 2023-03-21 11:22:48 +01:00
SChernykh c2d8c806d2 Removed fork code, only v2 is left 2023-03-19 17:19:25 +01:00
SChernykh 1cfacf4118 Code cleanup and fixes 2023-01-28 09:58:32 +01:00
SChernykh 33a592ee52 Fixed v2 signaling 2023-01-25 14:43:55 +01:00
SChernykh c841a2d2a9 Set new testnet hardfork date 2023-01-22 16:24:36 +01:00
SChernykh c855bb769a PoolBlock: removed unnecessary mutex 2023-01-17 13:20:09 +01:00
SChernykh f206e4b334 Testnet fork on January 21st 2023-01-16 15:36:21 +01:00
SChernykh d4329ae594 Show file:line where panic() was called from 2023-01-14 12:37:08 +01:00
SChernykh 47f551c046 Randomize output order for P2Pool payouts 2023-01-09 20:07:11 +01:00
SChernykh ae6747c82d Initialize tx key from previous blocks 2023-01-09 16:14:33 +01:00