aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-12-04 22:15:36 +0200
committerRiccardo Spagni <ric@spagni.net>2016-12-04 22:15:36 +0200
commit2fd43e25eef2c858f86c62862ff95942f01c6ec3 (patch)
treeadd4414dd6397faa5cdf41167879f0fdd1cdc460
parentMerge pull request #1384 (diff)
parentblockchain: reject invalid pubkeys from v4 (diff)
downloadmonero-2fd43e25eef2c858f86c62862ff95942f01c6ec3.tar.xz
Merge pull request #1386
8f6ec90c blockchain: reject invalid pubkeys from v4 (moneromooo-monero)
-rw-r--r--src/cryptonote_core/blockchain.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index c2ccf3db0..bf2b4b71a 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<txout_to_key>(o.target);
+ if (!crypto::check_key(out_to_key.key)) {
+ tvc.m_invalid_output = true;
+ return false;
+ }
+ }
+ }
+ }
+
return true;
}
//------------------------------------------------------------------