From 5f6703f2c2d0baf43f0cce8e3fc7d03fe791ec6b Mon Sep 17 00:00:00 2001 From: wowario Date: Tue, 31 Jan 2023 01:03:49 +0300 Subject: [PATCH] bump ring size to 22 --- src/cryptonote_config.h | 6 ++---- src/cryptonote_core/blockchain.cpp | 12 ++++++------ src/wallet/wallet2.cpp | 20 +++++++------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 2b4300013..e60398608 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -169,10 +169,8 @@ #define THREAD_STACK_SIZE 5 * 1024 * 1024 #define HF_VERSION_DYNAMIC_FEE 4 -#define HF_VERSION_MIN_MIXIN_4 6 -#define HF_VERSION_MIN_MIXIN_6 7 -#define HF_VERSION_MIN_MIXIN_10 8 -#define HF_VERSION_MIN_MIXIN_15 15 +#define HF_VERSION_MIN_MIXIN_7 7 +#define HF_VERSION_MIN_MIXIN_21 9 #define HF_VERSION_ENFORCE_RCT 6 #define HF_VERSION_PER_BYTE_FEE 12 #define HF_VERSION_SMALLER_BP 13 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 54ee3b088..a2cfa39c7 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -3342,7 +3342,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, size_t n_unmixable = 0, n_mixable = 0; size_t min_actual_mixin = std::numeric_limits::max(); size_t max_actual_mixin = 0; - const size_t min_mixin = hf_version >= HF_VERSION_MIN_MIXIN_15 ? 15 : hf_version >= HF_VERSION_MIN_MIXIN_10 ? 10 : hf_version >= HF_VERSION_MIN_MIXIN_6 ? 6 : hf_version >= HF_VERSION_MIN_MIXIN_4 ? 4 : 2; + const size_t min_mixin = hf_version >= HF_VERSION_MIN_MIXIN_21 ? 21 : 7; for (const auto& txin : tx.vin) { // non txin_to_key inputs will be rejected below @@ -3389,7 +3389,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, // allowed is when spending unmixable non-RCT outputs in the chain. // Caveat: at HF_VERSION_MIN_MIXIN_15, temporarily allow ring sizes // of 11 to allow a grace period in the transition to larger ring size. - if (min_actual_mixin < min_mixin && !(hf_version == HF_VERSION_MIN_MIXIN_15 && min_actual_mixin == 10)) + if (min_actual_mixin < min_mixin && !(hf_version == HF_VERSION_MIN_MIXIN_21 && min_actual_mixin == 7)) { if (n_unmixable == 0) { @@ -3403,10 +3403,10 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, tvc.m_low_mixin = true; return false; } - } else if ((hf_version > HF_VERSION_MIN_MIXIN_15 && min_actual_mixin > 15) - || (hf_version == HF_VERSION_MIN_MIXIN_15 && min_actual_mixin != 15 && min_actual_mixin != 10) // grace period to allow either 15 or 10 - || (hf_version < HF_VERSION_MIN_MIXIN_15 && hf_version >= HF_VERSION_MIN_MIXIN_10+2 && min_actual_mixin > 10) - || ((hf_version == HF_VERSION_MIN_MIXIN_10 || hf_version == HF_VERSION_MIN_MIXIN_10+1) && min_actual_mixin != 10) + } else if ((hf_version > HF_VERSION_MIN_MIXIN_21 && min_actual_mixin > 21) + || (hf_version == HF_VERSION_MIN_MIXIN_21 && min_actual_mixin != 21 && min_actual_mixin != 7) // grace period to allow either 15 or 10 + || (hf_version < HF_VERSION_MIN_MIXIN_21 && hf_version >= HF_VERSION_MIN_MIXIN_7+2 && min_actual_mixin > 7) + || ((hf_version == HF_VERSION_MIN_MIXIN_7 || hf_version == HF_VERSION_MIN_MIXIN_7+1) && min_actual_mixin != 7) ) { MERROR_VER("Tx " << get_transaction_hash(tx) << " has invalid ring size (" << (min_actual_mixin + 1) << "), it should be " << (min_mixin + 1)); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a450cc9eb..d48eaaa19 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -8128,25 +8128,19 @@ int wallet2::get_fee_algorithm() //------------------------------------------------------------------------------------------------------------------------------ uint64_t wallet2::get_min_ring_size() { - if (use_fork_rules(HF_VERSION_MIN_MIXIN_15, 0)) - return 16; - if (use_fork_rules(8, 10)) - return 11; + if (use_fork_rules(HF_VERSION_MIN_MIXIN_21, 0)) + return 22; if (use_fork_rules(7, 10)) - return 7; - if (use_fork_rules(6, 10)) - return 5; - if (use_fork_rules(2, 10)) - return 3; + return 8; return 0; } //------------------------------------------------------------------------------------------------------------------------------ uint64_t wallet2::get_max_ring_size() { - if (use_fork_rules(HF_VERSION_MIN_MIXIN_15, 0)) - return 16; - if (use_fork_rules(8, 10)) - return 11; + if (use_fork_rules(HF_VERSION_MIN_MIXIN_21, 0)) + return 22; + if (use_fork_rules(7, 10)) + return 8; return 0; } //------------------------------------------------------------------------------------------------------------------------------