increase minimum mixin to 4 on hard fork 5

This commit is contained in:
moneromooo-monero 2016-08-14 19:15:04 +01:00
parent 0815c72df7
commit 4f887dea6e
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 3 additions and 2 deletions

View File

@ -2330,6 +2330,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 mixin = std::numeric_limits<size_t>::max(); size_t mixin = std::numeric_limits<size_t>::max();
const size_t min_mixin = hf_version >= 5 ? 4 : 2;
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
@ -2348,7 +2349,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
uint64_t n_outputs = m_db->get_num_outputs(in_to_key.amount); uint64_t n_outputs = m_db->get_num_outputs(in_to_key.amount);
LOG_PRINT_L2("output size " << print_money(in_to_key.amount) << ": " << n_outputs << " available"); LOG_PRINT_L2("output size " << print_money(in_to_key.amount) << ": " << n_outputs << " available");
// n_outputs includes the output we're considering // n_outputs includes the output we're considering
if (n_outputs <= 2) if (n_outputs <= min_mixin)
++n_unmixable; ++n_unmixable;
else else
++n_mixable; ++n_mixable;
@ -2358,7 +2359,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
} }
} }
if (mixin < 2) if (mixin < min_mixin)
{ {
if (n_unmixable == 0) if (n_unmixable == 0)
{ {