aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-07-14 11:51:32 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-08-19 16:43:53 +0000
commitd22dfb75948e5ad382758c4731c840bd3f067cd0 (patch)
tree1d774027748f55af49533bfe1fda9e60e92ef7c9 /src
parentcore: from v12, require consistent ring size for mixable txes (diff)
downloadmonero-d22dfb75948e5ad382758c4731c840bd3f067cd0.tar.xz
blockchain: reject rct signatures in coinbase txes from v12
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_config.h1
-rw-r--r--src/cryptonote_core/blockchain.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index 834bd5f22..bd6755f48 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -152,6 +152,7 @@
#define HF_VERSION_MIN_2_OUTPUTS 12
#define HF_VERSION_MIN_V2_COINBASE_TX 12
#define HF_VERSION_SAME_MIXIN 12
+#define HF_VERSION_REJECT_SIGS_IN_COINBASE 12
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 3c5c928f6..b5c4abd08 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1208,6 +1208,13 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
CHECK_AND_ASSERT_MES(b.miner_tx.vin.size() == 1, false, "coinbase transaction in the block has no inputs");
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
CHECK_AND_ASSERT_MES(b.miner_tx.version > 1 || hf_version < HF_VERSION_MIN_V2_COINBASE_TX, false, "Invalid coinbase transaction version");
+
+ // for v2 txes (ringct), we only accept empty rct signatures for miner transactions,
+ if (hf_version >= HF_VERSION_REJECT_SIGS_IN_COINBASE && b.miner_tx.version >= 2)
+ {
+ CHECK_AND_ASSERT_MES(b.miner_tx.rct_signatures.type == rct::RCTTypeNull, false, "RingCT signatures not allowed in coinbase transactions");
+ }
+
if(boost::get<txin_gen>(b.miner_tx.vin[0]).height != height)
{
MWARNING("The miner transaction in block has invalid height: " << boost::get<txin_gen>(b.miner_tx.vin[0]).height << ", expected: " << height);