limit future blk time to 10 min

This commit is contained in:
wowario 2023-01-31 23:06:50 +03:00
parent 7b9bfb73b1
commit a0a90ada1a
No known key found for this signature in database
GPG Key ID: 793504B449C69220
2 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,7 @@
#define CURRENT_TRANSACTION_VERSION 2 #define CURRENT_TRANSACTION_VERSION 2
#define CURRENT_BLOCK_MAJOR_VERSION 7 #define CURRENT_BLOCK_MAJOR_VERSION 7
#define CURRENT_BLOCK_MINOR_VERSION 7 #define CURRENT_BLOCK_MINOR_VERSION 7
#define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2 300*2
#define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2 #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2
#define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 4 #define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 4

View File

@ -4061,9 +4061,11 @@ bool Blockchain::check_block_timestamp(std::vector<uint64_t>& timestamps, const
bool Blockchain::check_block_timestamp(const block& b, uint64_t& median_ts) const bool Blockchain::check_block_timestamp(const block& b, uint64_t& median_ts) const
{ {
LOG_PRINT_L3("Blockchain::" << __func__); LOG_PRINT_L3("Blockchain::" << __func__);
if(b.timestamp > (uint64_t)time(NULL) + CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT) uint8_t version = get_current_hard_fork_version();
uint64_t cryptonote_block_future_time_limit = version >= 8 ? CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2 : CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT;
if(b.timestamp > (uint64_t)time(NULL) + cryptonote_block_future_time_limit)
{ {
MERROR_VER("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", bigger than local time + 2 hours"); MERROR_VER("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", bigger than local time + 10 minutes");
return false; return false;
} }