Commit Graph

134 Commits

Author SHA1 Message Date
Matt Hess 0654c7258d Changed debug logs from level 3 to level 5, fixed shadowVariable warning from LOG_CATEGORY macro, Added shadowVariable to cppcheck/suppressions, Fixed variable lock shadowing outer variable 2025-12-26 17:56:54 +00:00
Matt Hess 63f277c5ae Port fix 37889→38889, Complete Salvium rewrite of README, Docker Salvium updates, XMRAmount → SALAmount, Merge mining warning 2025-12-25 03:45:19 +00:00
Matt Hess 3121932b17 Remove unused variable 'out_idx' in create_miner_tx, Add missingInclude to cppcheck suppressions for mx25519.h 2025-12-24 00:59:45 +00:00
Matt Hess fbb73f9658 Fix unit test crashes for Carrot v1 block format 2025-12-23 23:33:32 +00:00
Matt Hess 4ddfa22d1b Fixed implicit widening multiplication error, Removed unused "this", Fixed narrowing conversion, Made m_verified and m_invalid mutable, Removed else-after-return, Removed unused num_full_blocks and last_block_size var all to make clang-tidy happy 2025-12-18 00:52:40 +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 7441b02aff added donation state tracking, proper entering and exiting message, every 720 blocks on mainchain or 0.139% 2025-12-17 05:28:30 +00:00
Matt Hess 27dfd4788b fixing C/C++ CI errors 2025-12-17 03:28:41 +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 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 36d03d19fe Fix crash when stratum miners submit with stale templates
Added bounds check in get_hashing_blob_nolock() to handle empty
m_transactionHashes when old/stale template slots are accessed.
Returns 0 and logs at level 3 instead of vector out-of-bounds crash.

Primarily affects external stratum miners that may
hold onto old job IDs across template updates
2025-12-09 03:10:14 +00:00
Matt Hess 3316751f5e Adjusted more logging levels 2025-12-09 00:10:05 +00:00
Matt Hess 1d319325e5 Fix merkle tree calculation for mempool transactions
- Fixed m_transactionHashes to preserve mempool txs across template updates
- Changed merkle calculation to use merkle_hash() with all transactions
- Removed hardcoded 2-transaction merkle assumption for HF10+
- Synchronized m_poolBlockTemplate->m_transactions with m_transactionHashes
- Commented out premature m_transactionHashes.clear()
- Updated monerod references to salviumd
- Enhanced difficulty debug logging (lo/hi components)
2025-12-08 23:03:32 +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 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
Matt Hess cde94c9ea2 ensure single miner_tx output for Salvium compatibility 2025-11-16 23:45:27 +00:00
Matt Hess 735eb6737f fixed communication issue with tx version relay 2025-11-16 21:01:21 +00:00
Matt Hess e8c7b703f3 fixing block template submittal for protocol_tx 2025-11-16 02:18:09 +00:00
Matt Hess 853d4bf2db Dev donation setup based on N minutes per 100
- Designed like xmrig --donate-level but specific to the minute per 100 cycle
2025-11-13 16:13:59 +00:00
Matt Hess 8fa225b909 Revert "Add consensus-enforced 0.3% dev fee"
This reverts commit 2a41ad9670.
2025-11-13 04:59:08 +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
Matt Hess 2a41ad9670 Add consensus-enforced 0.3% dev fee 2025-11-12 17:34:00 +00:00
Matt Hess 62c654f77c Port P2Pool to Salvium 2025-11-12 15:20:13 +00:00
SChernykh cb9fc89b22 Added --onion-address command line option to support incoming TOR connections 2025-10-20 13:06:45 +02: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 dd9d5b03aa Merkle tree: added one more helper function 2025-10-05 19:04:31 +02:00
SChernykh 741aaf95a8 Removed old fork code 2025-10-04 12:41:35 +02:00
SChernykh 6b4c39f4c9 SideChain: added some extra checks, removed const_cast 2025-10-01 18:05:26 +02:00
SChernykh 0184a3139c CI: revised clang-tidy list of checks 2025-09-25 18:46:22 +02:00
SChernykh f6a1612ff1 Fixed build errors 2025-09-23 17:17:17 +02:00
SChernykh 1eb22109b5 Fixed m_mergeMiningExtra format description 2025-09-23 12:53:50 +02:00
SChernykh c0b99ac6fd Refactored BlockTemplate::update() - removed the use of pointers as parameters 2025-09-23 11:45:56 +02:00
SChernykh cff1210761 Store public viewkey of the subaddress 2025-09-22 19:00:43 +02:00
SChernykh 964f4c8065 Updated copyright 2025-07-14 20:30:33 +02:00
SChernykh 3f54025384 CI: added more block template tests 2025-06-21 13:16:56 +02:00
SChernykh 70298cd065 Merge mining donation support 2025-05-13 17:18:29 +02:00
SChernykh 1053e22a52 Removed hardfork code 2024-10-13 14:17:37 +02:00
SChernykh 245e6fd9e8 Fix: init Merkle tree before selecting txs 2024-06-18 18:27:07 +02:00
SChernykh 33e1ebd3fe Calculate hashing blobs in parallel
Improved performance with high number of connected miners.
2024-05-30 16:53:32 +02:00
SChernykh 59b693d2f3 P2Pool version: add patch number 2024-05-28 22:41:37 +02:00
SChernykh d0107ed148 Fixed block template generation
Mining with `--merge-mining` in the command line but with merge mining disabled was broken
2024-05-23 22:17:39 +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 fd953a0b26 Tari: serialize pow_data WIP 2024-05-09 20:35:41 +02:00
SChernykh 52b7c4fb25 Merge branch 'master' into merge-mining 2024-03-07 18:42:45 +01:00
SChernykh 29d84e3bcf Fixed data race in tx mempool 2024-03-07 17:48:49 +01:00