mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 13:23:29 +01:00
Merge pull request #1779
9effa553
core: bound the amount of entries in bad tx semantics cache (moneromooo-monero)240054a7
core: remove a couple unused/obsolete bits (moneromooo-monero)
This commit is contained in:
commit
2b38973b5c
@ -60,6 +60,8 @@ DISABLE_VS_WARNINGS(4355)
|
|||||||
|
|
||||||
#define MERROR_VER(x) MCERROR("verify", x)
|
#define MERROR_VER(x) MCERROR("verify", x)
|
||||||
|
|
||||||
|
#define BAD_SEMANTICS_TXES_MAX_SIZE 100
|
||||||
|
|
||||||
namespace cryptonote
|
namespace cryptonote
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -496,12 +498,15 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
//std::cout << "!"<< tx.vin.size() << std::endl;
|
//std::cout << "!"<< tx.vin.size() << std::endl;
|
||||||
|
|
||||||
if (bad_semantics_txes.find(tx_hash) != bad_semantics_txes.end())
|
for (int idx = 0; idx < 2; ++idx)
|
||||||
|
{
|
||||||
|
if (bad_semantics_txes[idx].find(tx_hash) != bad_semantics_txes[idx].end())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("Transaction already seen with bad semantics, rejected");
|
LOG_PRINT_L1("Transaction already seen with bad semantics, rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t version = m_blockchain_storage.get_current_hard_fork_version();
|
uint8_t version = m_blockchain_storage.get_current_hard_fork_version();
|
||||||
const size_t max_tx_version = version == 1 ? 1 : 2;
|
const size_t max_tx_version = version == 1 ? 1 : 2;
|
||||||
@ -551,8 +556,13 @@ namespace cryptonote
|
|||||||
if(!check_tx_semantic(tx, keeped_by_block))
|
if(!check_tx_semantic(tx, keeped_by_block))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
|
||||||
bad_semantics_txes.insert(tx_hash);
|
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
|
bad_semantics_txes[0].insert(tx_hash);
|
||||||
|
if (bad_semantics_txes[0].size() >= BAD_SEMANTICS_TXES_MAX_SIZE)
|
||||||
|
{
|
||||||
|
std::swap(bad_semantics_txes[0], bad_semantics_txes[1]);
|
||||||
|
bad_semantics_txes[0].clear();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,7 +818,6 @@ namespace cryptonote
|
|||||||
epee::math_helper::once_a_time_seconds<60*2, false> m_txpool_auto_relayer; //!< interval for checking re-relaying txpool transactions
|
epee::math_helper::once_a_time_seconds<60*2, false> m_txpool_auto_relayer; //!< interval for checking re-relaying txpool transactions
|
||||||
epee::math_helper::once_a_time_seconds<60*60*12, true> m_check_updates_interval; //!< interval for checking for new versions
|
epee::math_helper::once_a_time_seconds<60*60*12, true> m_check_updates_interval; //!< interval for checking for new versions
|
||||||
|
|
||||||
friend class tx_validate_inputs;
|
|
||||||
std::atomic<bool> m_starter_message_showed; //!< has the "daemon will sync now" message been shown?
|
std::atomic<bool> m_starter_message_showed; //!< has the "daemon will sync now" message been shown?
|
||||||
|
|
||||||
uint64_t m_target_blockchain_height; //!< blockchain height target
|
uint64_t m_target_blockchain_height; //!< blockchain height target
|
||||||
@ -833,13 +832,11 @@ namespace cryptonote
|
|||||||
|
|
||||||
std::atomic_flag m_checkpoints_updating; //!< set if checkpoints are currently updating to avoid multiple threads attempting to update at once
|
std::atomic_flag m_checkpoints_updating; //!< set if checkpoints are currently updating to avoid multiple threads attempting to update at once
|
||||||
|
|
||||||
boost::interprocess::file_lock db_lock; //!< a lock object for a file lock in the db directory
|
|
||||||
|
|
||||||
size_t block_sync_size;
|
size_t block_sync_size;
|
||||||
|
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
|
|
||||||
std::unordered_set<crypto::hash> bad_semantics_txes;
|
std::unordered_set<crypto::hash> bad_semantics_txes[2];
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UPDATES_DISABLED,
|
UPDATES_DISABLED,
|
||||||
|
Loading…
Reference in New Issue
Block a user