diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index ae8db1ef4..8fa7f30e7 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -903,18 +903,6 @@ namespace cryptonote int t_cryptonote_protocol_handler::handle_notify_new_transactions(int command, NOTIFY_NEW_TRANSACTIONS::request& arg, cryptonote_connection_context& context) { MLOG_P2P_MESSAGE("Received NOTIFY_NEW_TRANSACTIONS (" << arg.txs.size() << " txes)"); - std::unordered_set seen; - for (const auto &blob: arg.txs) - { - MLOGIF_P2P_MESSAGE(cryptonote::transaction tx; crypto::hash hash; bool ret = cryptonote::parse_and_validate_tx_from_blob(blob, tx, hash);, ret, "Including transaction " << hash); - if (seen.find(blob) != seen.end()) - { - LOG_PRINT_CCONTEXT_L1("Duplicate transaction in notification, dropping connection"); - drop_connection(context, false, false); - return 1; - } - seen.insert(blob); - } if(context.m_state != cryptonote_connection_context::state_normal) return 1; @@ -928,6 +916,19 @@ namespace cryptonote return 1; } + std::unordered_set seen; + for (const auto &blob: arg.txs) + { + MLOGIF_P2P_MESSAGE(cryptonote::transaction tx; crypto::hash hash; bool ret = cryptonote::parse_and_validate_tx_from_blob(blob, tx, hash);, ret, "Including transaction " << hash); + if (seen.find(blob) != seen.end()) + { + LOG_PRINT_CCONTEXT_L1("Duplicate transaction in notification, dropping connection"); + drop_connection(context, false, false); + return 1; + } + seen.insert(blob); + } + /* If the txes were received over i2p/tor, the default is to "forward" with a randomized delay to further enhance the "white noise" behavior, potentially making it harder for ISP-level spies to determine which