Handle current Monero daemon templates
This commit is contained in:
@@ -264,7 +264,12 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
||||
ar(m_height);
|
||||
ar(m_numOutputs);
|
||||
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
if (m_coin == Coin::MONERO) {
|
||||
if (m_numOutputs < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (m_coin == Coin::ZEPHYR) {
|
||||
if (m_numOutputs < 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -343,6 +348,28 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
||||
ar(m_viewTag);
|
||||
}
|
||||
|
||||
if (m_coin == Coin::MONERO && m_numOutputs > 1) {
|
||||
for (uint64_t k = 1; k < m_numOutputs; ++k) {
|
||||
uint64_t amount2;
|
||||
ar(amount2);
|
||||
|
||||
uint8_t output_type2;
|
||||
ar(output_type2);
|
||||
|
||||
if ((output_type2 != kTxOutToKey) && (output_type2 != kTxOutToTaggedKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Span key2;
|
||||
ar(key2, kKeySize);
|
||||
|
||||
if (output_type2 == kTxOutToTaggedKey) {
|
||||
uint8_t view_tag2;
|
||||
ar(view_tag2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_coin == Coin::SALVIUM && m_numOutputs > 1) {
|
||||
for (uint64_t k = 1; k < m_numOutputs; ++k) {
|
||||
uint64_t amount2;
|
||||
@@ -477,6 +504,27 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some current parent daemon templates omit an explicit trailing tx_hashes_count=0
|
||||
// when there are no non-coinbase transactions in the block template.
|
||||
if (ar.remaining() == 0) {
|
||||
m_numHashes = 0;
|
||||
|
||||
if (hashes) {
|
||||
const uint64_t base_count = baseTransactionCount();
|
||||
m_hashes.resize(base_count * kHashSize);
|
||||
|
||||
calculateMinerTxHash(blob(MINER_TX_PREFIX_OFFSET), blob(MINER_TX_PREFIX_END_OFFSET), m_hashes.data());
|
||||
|
||||
if (m_hasProtocolTx) {
|
||||
calculateMinerTxHash(blob(PROTOCOL_TX_PREFIX_OFFSET), blob(PROTOCOL_TX_PREFIX_END_OFFSET), m_hashes.data() + kHashSize);
|
||||
}
|
||||
|
||||
calculateMerkleTreeHash();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_hasProtocolTx) {
|
||||
|
||||
// Protocol transaction begin
|
||||
|
||||
Reference in New Issue
Block a user