Merge branch 'merge_mining_tag_fix' of https://github.com/StriderDM/xmrig into StriderDM-merge_mining_tag_fix

This commit is contained in:
XMRig 2021-10-13 05:33:34 +07:00
commit 35ba786e63
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 21 additions and 7 deletions

View file

@ -72,7 +72,14 @@ int64_t xmrig::SelfSelectClient::submit(const JobResult &result)
submitOriginDaemon(result); submitOriginDaemon(result);
} }
return m_client->submit(result); uint64_t submit_result = m_client->submit(result);
if (m_submitToOrigin) {
// Ensure that the latest block template is available after block submission
getBlockTemplate();
}
return submit_result;
} }
@ -285,9 +292,6 @@ void xmrig::SelfSelectClient::submitOriginDaemon(const JobResult& result)
LOG_INFO("%s " GREEN_BOLD("submitted to origin daemon") " (%" PRId64 "/%" PRId64 ") " LOG_INFO("%s " GREEN_BOLD("submitted to origin daemon") " (%" PRId64 "/%" PRId64 ") "
" diff " WHITE("%" PRIu64) " vs. " WHITE("%" PRIu64), " diff " WHITE("%" PRIu64) " vs. " WHITE("%" PRIu64),
Tags::origin(), m_originSubmitted, m_originNotSubmitted, m_blockDiff, result.actualDiff(), result.diff); Tags::origin(), m_originSubmitted, m_originNotSubmitted, m_blockDiff, result.actualDiff(), result.diff);
// Ensure that the latest block template is available after block submission
getBlockTemplate();
} }
void xmrig::SelfSelectClient::onHttpData(const HttpData &data) void xmrig::SelfSelectClient::onHttpData(const HttpData &data)

View file

@ -249,10 +249,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
switch (extra_tag) { switch (extra_tag) {
case 0x01: // TX_EXTRA_TAG_PUBKEY case 0x01: // TX_EXTRA_TAG_PUBKEY
{
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index()); setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
ar_extra.skip(kKeySize); ar_extra.skip(kKeySize);
break; break;
}
case 0x02: // TX_EXTRA_NONCE case 0x02: // TX_EXTRA_NONCE
{ {
uint64_t size = 0; uint64_t size = 0;
@ -261,7 +262,14 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar_extra(m_txExtraNonce, size); ar_extra(m_txExtraNonce, size);
} }
break; break;
case 0x03: // TX_EXTRA_MERGE_MINING_TAG
{
uint64_t size = 0;
ar_extra(size);
setOffset(TX_EXTRA_MERGE_MINING_TAG_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
ar_extra(m_txMergeMiningTag, size+kKeySize);
break;
}
default: default:
return false; // TODO(SChernykh): handle other tags return false; // TODO(SChernykh): handle other tags
} }

View file

@ -54,6 +54,7 @@ public:
TX_EXTRA_OFFSET, TX_EXTRA_OFFSET,
TX_PUBKEY_OFFSET, TX_PUBKEY_OFFSET,
TX_EXTRA_NONCE_OFFSET, TX_EXTRA_NONCE_OFFSET,
TX_EXTRA_MERGE_MINING_TAG_OFFSET,
OFFSET_COUNT OFFSET_COUNT
}; };
@ -86,6 +87,7 @@ public:
inline uint64_t outputType() const { return m_outputType; } inline uint64_t outputType() const { return m_outputType; }
inline const Span &ephPublicKey() const { return m_ephPublicKey; } inline const Span &ephPublicKey() const { return m_ephPublicKey; }
inline const Span &txExtraNonce() const { return m_txExtraNonce; } inline const Span &txExtraNonce() const { return m_txExtraNonce; }
inline const Span &txMergeMiningTag() const { return m_txMergeMiningTag; }
// Transaction hashes // Transaction hashes
inline uint64_t numHashes() const { return m_numHashes; } inline uint64_t numHashes() const { return m_numHashes; }
@ -140,7 +142,7 @@ private:
Span m_ephPublicKey; Span m_ephPublicKey;
uint64_t m_extraSize = 0; uint64_t m_extraSize = 0;
Span m_txExtraNonce; Span m_txExtraNonce;
Span m_txMergeMiningTag = 0;
uint64_t m_numHashes = 0; uint64_t m_numHashes = 0;
Buffer m_hashes; Buffer m_hashes;
Buffer m_minerTxMerkleTreeBranch; Buffer m_minerTxMerkleTreeBranch;