Randomize extra_nonce

To guarantee that hashing blobs will be different between different p2pool nodes, even if they mine to the same wallet address and don't have transactions to shuffle within the block template.
This commit is contained in:
SChernykh
2022-10-11 11:30:02 +02:00
parent 02405bb8ff
commit a917a9493c
3 changed files with 17 additions and 10 deletions

View File

@@ -25,6 +25,7 @@
#include "params.h"
#include "p2pool_api.h"
#include "side_chain.h"
#include "p2p_server.h"
#include <thread>
static constexpr char log_category_prefix[] = "Miner ";
@@ -40,7 +41,7 @@ Miner::Miner(p2pool* pool, uint32_t threads)
, m_startTimestamp(high_resolution_clock::now())
, m_nonce(0)
, m_nonceTimestamp(m_startTimestamp)
, m_extraNonce(0xF19E3779U)
, m_extraNonce(static_cast<uint32_t>(pool->p2p_server()->get_random64()))
, m_totalHashes(0)
, m_sharesFound(0)
, m_job{}