diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-23 21:56:04 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-23 22:09:35 +0000 |
commit | df83ed74e487d6f828164bb9652681801abb439e (patch) | |
tree | 485ef5a7d3cc778ba98a4b63aa8272fd86f04561 /src/crypto | |
parent | Merge pull request #5466 (diff) | |
download | monero-df83ed74e487d6f828164bb9652681801abb439e.tar.xz |
consensus: from v12, enforce >= 2 outputs
Diffstat (limited to '')
-rw-r--r-- | src/cryptonote_basic/verification_context.h | 1 | ||||
-rw-r--r-- | src/cryptonote_config.h | 1 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 13 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/cryptonote_basic/verification_context.h b/src/cryptonote_basic/verification_context.h index 36b63f254..3d7200fae 100644 --- a/src/cryptonote_basic/verification_context.h +++ b/src/cryptonote_basic/verification_context.h @@ -48,6 +48,7 @@ namespace cryptonote bool m_overspend; bool m_fee_too_low; bool m_not_rct; + bool m_too_few_outputs; }; struct block_verification_context diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 56b6a63b7..fc718c4f7 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -147,6 +147,7 @@ #define HF_VERSION_PER_BYTE_FEE 8 #define HF_VERSION_SMALLER_BP 10 #define HF_VERSION_LONG_TERM_BLOCK_WEIGHT 10 +#define HF_VERSION_MIN_2_OUTPUTS 12 #define PER_KB_FEE_QUANTIZATION_DECIMALS 8 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index f733efb2f..e2cf9a703 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2800,6 +2800,19 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, const uint8_t hf_version = m_hardfork->get_current_version(); + if (hf_version >= HF_VERSION_MIN_2_OUTPUTS) + { + if (tx.version >= 2) + { + if (tx.vout.size() < 2) + { + MERROR_VER("Tx " << get_transaction_hash(tx) << " has fewer than two outputs"); + tvc.m_too_few_outputs = true; + return false; + } + } + } + // from hard fork 2, we require mixin at least 2 unless one output cannot mix with 2 others // if one output cannot mix with 2 others, we accept at most 1 output that can mix if (hf_version >= 2) |