From 8f6ec90c83f63a8b20ac3c977379067dc1589342 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 28 Nov 2016 22:32:13 +0000 Subject: [PATCH] blockchain: reject invalid pubkeys from v4 --- src/cryptonote_core/blockchain.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index c2ccf3db..bf2b4b71 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2231,6 +2231,19 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context } } + // from v4, forbid invalid pubkeys + if (m_hardfork->get_current_version() >= 4) { + for (const auto &o: tx.vout) { + if (o.target.type() == typeid(txout_to_key)) { + const txout_to_key& out_to_key = boost::get(o.target); + if (!crypto::check_key(out_to_key.key)) { + tvc.m_invalid_output = true; + return false; + } + } + } + } + return true; } //------------------------------------------------------------------