From 24c941ddfebc5eff323f28cab54cb68563a2e3bb Mon Sep 17 00:00:00 2001 From: zachhildreth Date: Fri, 25 Dec 2020 18:32:37 +0000 Subject: [PATCH] fix: change valid vote minute from 2-3 to 3 Only allow the vote to be added on the 3rd minute of the hour, as this mitigates a potential attack where a user could vote for a known block producer at the top of the hour and get the staking rewards --- src/cryptonote_config.h | 2 +- src/simplewallet/simplewallet.cpp | 2 +- src/wallet/api/wallet.cpp | 2 +- src/wallet/wallet_rpc_server.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 56e23955868..b8b5fc48a05 100755 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -217,7 +217,6 @@ full_addrs.insert(SEED_NODE_5); // Blockchain #define HF_VERSION_PROOF_OF_STAKE 13 -//#define HF_BLOCK_HEIGHT_PROOF_OF_STAKE 521850 // The first block of the X-CASH proof of stake #define HF_BLOCK_HEIGHT_PROOF_OF_STAKE 760000 // The first block of the X-CASH proof of stake #define BLOCK_TIME 5 // the block time in minutes #define BLOCKS_PER_DAY_FIVE_MINUTE_BLOCK_TIME 288 // The blocks per day with a 5 minute block time @@ -421,3 +420,4 @@ namespace cryptonote }; } + diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index a97fc282768..6cabc4b569f 100755 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2286,7 +2286,7 @@ void sync_minutes_and_seconds(const int SETTINGS) std::this_thread::sleep_for(std::chrono::milliseconds(200)); current_date_and_time = std::time(0); current_UTC_date_and_time = std::gmtime(¤t_date_and_time); - } while (current_UTC_date_and_time->tm_min != 2); + } while (current_UTC_date_and_time->tm_min != 3); } // wait a random amount of time, so all messages from delegates that have been waiting dont get sent at the same time diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index a722427156b..e02165d2eb2 100755 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -2331,7 +2331,7 @@ void sync_minutes_and_seconds(const int SETTINGS) std::this_thread::sleep_for(std::chrono::milliseconds(200)); current_date_and_time = std::time(0); current_UTC_date_and_time = std::gmtime(¤t_date_and_time); - } while (current_UTC_date_and_time->tm_min != 2); + } while (current_UTC_date_and_time->tm_min != 3); } // wait a random amount of time, so all messages from delegates that have been waiting dont get sent at the same time diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index e3f5a4d90ea..8c7880da647 100755 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -3409,7 +3409,7 @@ void sync_minutes_and_seconds(const int SETTINGS) std::this_thread::sleep_for(std::chrono::milliseconds(200)); current_date_and_time = std::time(0); current_UTC_date_and_time = std::gmtime(¤t_date_and_time); - } while (current_UTC_date_and_time->tm_min != 2); + } while (current_UTC_date_and_time->tm_min != 3); } // wait a random amount of time, so all messages from delegates that have been waiting dont get sent at the same time