From cd85f98a231e88029d4af97cf6357f457ebb55a7 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 21 Nov 2019 14:23:54 +0100 Subject: [PATCH] Decrease the block time threshold (3x) (#1233) --- neo.UnitTests/Consensus/UT_Consensus.cs | 1 - neo/Consensus/ConsensusService.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/neo.UnitTests/Consensus/UT_Consensus.cs b/neo.UnitTests/Consensus/UT_Consensus.cs index c8d8fbf6c4..c10e6c94e3 100644 --- a/neo.UnitTests/Consensus/UT_Consensus.cs +++ b/neo.UnitTests/Consensus/UT_Consensus.cs @@ -20,7 +20,6 @@ namespace Neo.UnitTests.Consensus { - [TestClass] public class ConsensusTests : TestKit { diff --git a/neo/Consensus/ConsensusService.cs b/neo/Consensus/ConsensusService.cs index 574082043a..9d0bd5a343 100644 --- a/neo/Consensus/ConsensusService.cs +++ b/neo/Consensus/ConsensusService.cs @@ -405,7 +405,7 @@ private void OnPrepareRequestReceived(ConsensusPayload payload, PrepareRequest m if (context.RequestSentOrReceived || context.NotAcceptingPayloadsDueToViewChanging) return; if (payload.ValidatorIndex != context.Block.ConsensusData.PrimaryIndex || message.ViewNumber != context.ViewNumber) return; Log($"{nameof(OnPrepareRequestReceived)}: height={payload.BlockIndex} view={message.ViewNumber} index={payload.ValidatorIndex} tx={message.TransactionHashes.Length}"); - if (message.Timestamp <= context.PrevHeader.Timestamp || message.Timestamp > TimeProvider.Current.UtcNow.AddMinutes(10).ToTimestampMS()) + if (message.Timestamp <= context.PrevHeader.Timestamp || message.Timestamp > TimeProvider.Current.UtcNow.AddMilliseconds(8 * Blockchain.MillisecondsPerBlock).ToTimestampMS()) { Log($"Timestamp incorrect: {message.Timestamp}", LogLevel.Warning); return;