diff --git a/src/base/tools/cryptonote/BlockTemplate.cpp b/src/base/tools/cryptonote/BlockTemplate.cpp index 4cdbed224..4aac87d56 100644 --- a/src/base/tools/cryptonote/BlockTemplate.cpp +++ b/src/base/tools/cryptonote/BlockTemplate.cpp @@ -244,32 +244,29 @@ bool xmrig::BlockTemplate::parse(bool hashes) ar.skip(m_extraSize); while (ar_extra.index() < m_extraSize) { - uint64_t extra_tag = 0; + uint64_t extra_tag = 0; + uint64_t size = 0; + ar_extra(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()); ar_extra.skip(kKeySize); break; - } + case 0x02: // TX_EXTRA_NONCE - { - uint64_t size = 0; - ar_extra(size); - setOffset(TX_EXTRA_NONCE_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index()); - ar_extra(m_txExtraNonce, size); - } + ar_extra(size); + setOffset(TX_EXTRA_NONCE_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index()); + ar_extra(m_txExtraNonce, size); 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); + ar_extra(m_txMergeMiningTag, size + kKeySize); break; - } + default: return false; // TODO(SChernykh): handle other tags }