From 0c201ab43813477dfd7924656fb9e3716d0faed5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Apr 2020 16:48:37 +0000 Subject: [PATCH] cryptonote: fix reuse of non default tx data when relaying An automatic tx variable is initialized properly on the first run through the loop, but not the second. Moving the variable inside the loop ensures the ctor is called again to init it. --- src/cryptonote_basic/cryptonote_format_utils.cpp | 2 ++ src/cryptonote_core/cryptonote_core.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index 83301a508..12cd5c0ca 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -160,6 +160,8 @@ namespace cryptonote if (tx.version >= 2 && !is_coinbase(tx)) { rct::rctSig &rv = tx.rct_signatures; + if (rv.type == rct::RCTTypeNull) + return true; if (rv.outPk.size() != tx.vout.size()) { LOG_PRINT_L1("Failed to parse transaction from blob, bad outPk size in tx " << get_transaction_hash(tx)); diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index b3d65c3b8..12c47dbcf 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1349,9 +1349,9 @@ namespace cryptonote std::vector tx_hashes{}; tx_hashes.resize(tx_blobs.size()); - cryptonote::transaction tx{}; for (std::size_t i = 0; i < tx_blobs.size(); ++i) { + cryptonote::transaction tx{}; if (!parse_and_validate_tx_from_blob(tx_blobs[i], tx, tx_hashes[i])) { LOG_ERROR("Failed to parse relayed transaction");