From 733b85a13248ca6fcd79b8cc457002d483f720e4 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 13 Oct 2021 05:43:05 +0700 Subject: [PATCH] Code cleanup. --- src/base/tools/cryptonote/BlockTemplate.cpp | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) 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 }