Fixing miner issues
- Switch from full-block to header-only (140-byte) RandomX input - Add 32-byte SoloNonce system for solo mining mode - Compute proper difficulty target from compact bits field - Add SHA256D dual-hash PoW check in CpuWorker for solo mining - Raise RandomX dataset/scratchpad limits to 4GB/4MB - Use standard RandomX share filtering in pool (stratum) mode
This commit is contained in:
@@ -77,11 +77,11 @@ private:
|
||||
|
||||
// Block serialization
|
||||
std::vector<uint8_t> serializeBlock(uint32_t nonce, uint64_t extraNonce) const;
|
||||
std::vector<uint8_t> serializeHeader(uint32_t nonce, const uint8_t* solution) const;
|
||||
std::string serializeBlockHex(uint32_t nonce, const uint8_t* solution) const;
|
||||
std::vector<uint8_t> serializeHeader(const uint8_t* nonce32, const uint8_t* solution) const;
|
||||
std::string serializeBlockHex(const uint8_t* nonce32, const uint8_t* solution) const;
|
||||
|
||||
// PoW verification (SHA256D of header with solution)
|
||||
bool checkPow(uint32_t nonce, const uint8_t* solution) const;
|
||||
bool checkPow(const uint8_t* nonce32, const uint8_t* solution) const;
|
||||
static void sha256d(const uint8_t* data, size_t len, uint8_t* out);
|
||||
|
||||
// Target/difficulty conversion
|
||||
@@ -117,6 +117,13 @@ private:
|
||||
std::vector<uint8_t> m_headerBlob;
|
||||
size_t m_nonceOffset = 0; // Offset of nNonce field in the block blob
|
||||
|
||||
// Cached binary header fields for block serialization (avoids re-parsing hex each submit)
|
||||
uint8_t m_headerPrevHash[32] = {};
|
||||
uint8_t m_headerMerkleRoot[32] = {};
|
||||
uint8_t m_headerSaplingRoot[32] = {};
|
||||
uint32_t m_headerTime = 0;
|
||||
uint32_t m_headerBits = 0;
|
||||
|
||||
// Request tracking
|
||||
enum RequestType { REQ_NONE, REQ_TEMPLATE, REQ_KEYHASH, REQ_SUBMIT };
|
||||
RequestType m_pendingRequest = REQ_NONE;
|
||||
|
||||
Reference in New Issue
Block a user