Skip to content

Commit

Permalink
Change timeout even further
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarcps committed Dec 6, 2024
1 parent 12d370c commit 3b648ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/consensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void Consensus::pullerLoop() {
}
}

// Check if the latest block is older than 500ms. If yes, attempt to sync blocks.
// Check if the latest block is older than 100ms. If yes, attempt to sync blocks.
{
// Get the timestamp of the latest known block
auto latestBlock = this->storage_.latest();
Expand All @@ -84,7 +84,7 @@ void Consensus::pullerLoop() {
auto now = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
// Compute the age of the block in milliseconds
auto blockAge = now - lastBlockTimestamp;
if (blockAge > 500000) {
if (blockAge > 100000) {
// We are considered "behind" and need to sync blocks.
// Get connected nodes with their info
auto connected = this->p2p_.getNodeConns().getConnected();
Expand All @@ -99,7 +99,7 @@ void Consensus::pullerLoop() {
auto currentNHeight = latestBlock->getNHeight();
// If we are not synced
if (highestNode.second > currentNHeight) {
Utils::safePrint("Block is older than 500ms, attempting to sync blocks.");
Utils::safePrint("Block is older than 100ms, attempting to sync blocks.");
Utils::safePrint("Highest node with height: " + std::to_string(highestNode.second));
// For example:
uint64_t blocksPerRequest = 100;
Expand Down

0 comments on commit 3b648ac

Please sign in to comment.