mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 11:23:26 +01:00
core: allow v1 txes after HF 5 when sweeping unmixable outputs
This commit is contained in:
parent
f782d45827
commit
0815c72df7
@ -2322,9 +2322,11 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
||||
|
||||
crypto::hash tx_prefix_hash = get_transaction_prefix_hash(tx);
|
||||
|
||||
const uint8_t hf_version = m_hardfork->get_current_version();
|
||||
|
||||
// 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 (m_hardfork->get_current_version() >= 2)
|
||||
if (hf_version >= 2)
|
||||
{
|
||||
size_t n_unmixable = 0, n_mixable = 0;
|
||||
size_t mixin = std::numeric_limits<size_t>::max();
|
||||
@ -2371,6 +2373,22 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// min/max tx version based on HF, and we accept v1 txes if having a non mixable
|
||||
const size_t max_tx_version = (hf_version <= 3) ? 1 : 2;
|
||||
if (tx.version > max_tx_version)
|
||||
{
|
||||
LOG_PRINT_L1("transaction version " << (unsigned)tx.version << " is higher than max accepted version " << max_tx_version);
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
const size_t min_tx_version = (n_unmixable > 0 ? 1 : (hf_version >= 5) ? 2 : 1);
|
||||
if (tx.version < min_tx_version)
|
||||
{
|
||||
LOG_PRINT_L1("transaction version " << (unsigned)tx.version << " is lower than min accepted version " << min_tx_version);
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto it = m_check_txin_table.find(tx_prefix_hash);
|
||||
|
@ -86,21 +86,6 @@ namespace cryptonote
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t max_tx_version = (version <= 3) ? 1 : 2;
|
||||
if (tx.version > max_tx_version)
|
||||
{
|
||||
LOG_PRINT_L1("transaction version " << (unsigned)tx.version << " is higher than max accepted version " << max_tx_version);
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
const size_t min_tx_version = (version >= 5) ? 2 : 1;
|
||||
if (tx.version < min_tx_version)
|
||||
{
|
||||
LOG_PRINT_L1("transaction version " << (unsigned)tx.version << " is lower than min accepted version " << min_tx_version);
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// we do not accept transactions that timed out before, unless they're
|
||||
// kept_by_block
|
||||
if (!kept_by_block && m_timed_out_transactions.find(id) != m_timed_out_transactions.end())
|
||||
|
Loading…
Reference in New Issue
Block a user