Skip to content

Commit

Permalink
fix: change valid vote minute from 2-3 to 3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zachhildreth committed Dec 25, 2020
1 parent 9e84c22 commit 24c941d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -421,3 +420,4 @@ namespace cryptonote
};
}


2 changes: 1 addition & 1 deletion src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_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
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/api/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_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
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_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
Expand Down

0 comments on commit 24c941d

Please sign in to comment.