bump ring size to 22

This commit is contained in:
wowario 2023-01-31 01:03:49 +03:00
parent 4c6e685174
commit 5f6703f2c2
No known key found for this signature in database
GPG Key ID: 793504B449C69220
3 changed files with 15 additions and 23 deletions

View File

@ -169,10 +169,8 @@
#define THREAD_STACK_SIZE 5 * 1024 * 1024 #define THREAD_STACK_SIZE 5 * 1024 * 1024
#define HF_VERSION_DYNAMIC_FEE 4 #define HF_VERSION_DYNAMIC_FEE 4
#define HF_VERSION_MIN_MIXIN_4 6 #define HF_VERSION_MIN_MIXIN_7 7
#define HF_VERSION_MIN_MIXIN_6 7 #define HF_VERSION_MIN_MIXIN_21 9
#define HF_VERSION_MIN_MIXIN_10 8
#define HF_VERSION_MIN_MIXIN_15 15
#define HF_VERSION_ENFORCE_RCT 6 #define HF_VERSION_ENFORCE_RCT 6
#define HF_VERSION_PER_BYTE_FEE 12 #define HF_VERSION_PER_BYTE_FEE 12
#define HF_VERSION_SMALLER_BP 13 #define HF_VERSION_SMALLER_BP 13

View File

@ -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 n_unmixable = 0, n_mixable = 0;
size_t min_actual_mixin = std::numeric_limits<size_t>::max(); size_t min_actual_mixin = std::numeric_limits<size_t>::max();
size_t max_actual_mixin = 0; 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) for (const auto& txin : tx.vin)
{ {
// non txin_to_key inputs will be rejected below // 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. // allowed is when spending unmixable non-RCT outputs in the chain.
// Caveat: at HF_VERSION_MIN_MIXIN_15, temporarily allow ring sizes // 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. // 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) if (n_unmixable == 0)
{ {
@ -3403,10 +3403,10 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
tvc.m_low_mixin = true; tvc.m_low_mixin = true;
return false; return false;
} }
} else if ((hf_version > HF_VERSION_MIN_MIXIN_15 && min_actual_mixin > 15) } else if ((hf_version > HF_VERSION_MIN_MIXIN_21 && min_actual_mixin > 21)
|| (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_21 && min_actual_mixin != 21 && min_actual_mixin != 7) // 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_21 && hf_version >= HF_VERSION_MIN_MIXIN_7+2 && min_actual_mixin > 7)
|| ((hf_version == HF_VERSION_MIN_MIXIN_10 || hf_version == HF_VERSION_MIN_MIXIN_10+1) && min_actual_mixin != 10) || ((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)); MERROR_VER("Tx " << get_transaction_hash(tx) << " has invalid ring size (" << (min_actual_mixin + 1) << "), it should be " << (min_mixin + 1));

View File

@ -8128,25 +8128,19 @@ int wallet2::get_fee_algorithm()
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
uint64_t wallet2::get_min_ring_size() uint64_t wallet2::get_min_ring_size()
{ {
if (use_fork_rules(HF_VERSION_MIN_MIXIN_15, 0)) if (use_fork_rules(HF_VERSION_MIN_MIXIN_21, 0))
return 16; return 22;
if (use_fork_rules(8, 10))
return 11;
if (use_fork_rules(7, 10)) if (use_fork_rules(7, 10))
return 7; return 8;
if (use_fork_rules(6, 10))
return 5;
if (use_fork_rules(2, 10))
return 3;
return 0; return 0;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
uint64_t wallet2::get_max_ring_size() uint64_t wallet2::get_max_ring_size()
{ {
if (use_fork_rules(HF_VERSION_MIN_MIXIN_15, 0)) if (use_fork_rules(HF_VERSION_MIN_MIXIN_21, 0))
return 16; return 22;
if (use_fork_rules(8, 10)) if (use_fork_rules(7, 10))
return 11; return 8;
return 0; return 0;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------