diff --git a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs index b00fdd9393..6884026dc4 100644 --- a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs +++ b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs @@ -98,6 +98,9 @@ private void OnPrepareRequestReceived(ExtensiblePayload payload, PrepareRequest // around 2*15/M=30.0/5 ~ 40% block time (for M=5) ExtendTimerByFactor(2); + onPrepareReceivedTime = TimeProvider.Current.UtcNow; + onPrepareBlockIndex = message.BlockIndex; + context.Block.Header.Timestamp = message.Timestamp; context.Block.Header.Nonce = message.Nonce; context.TransactionHashes = message.TransactionHashes; diff --git a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.cs b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.cs index ad1b88feb1..7bfa1ad78e 100644 --- a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.cs +++ b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.cs @@ -37,6 +37,8 @@ private class Timer { public uint Height; public byte ViewNumber; } private ICancelable timer_token; private DateTime block_received_time; private uint block_received_index; + private DateTime onPrepareReceivedTime; + private uint onPrepareBlockIndex; private bool started = false; /// @@ -95,9 +97,10 @@ private void InitializeConsensus(byte viewNumber) else { TimeSpan span = neoSystem.Settings.TimePerBlock; - if (block_received_index + 1 == context.Block.Index) + if (block_received_index + 1 == context.Block.Index && onPrepareBlockIndex + 1 == context.Block.Index) { - var diff = TimeProvider.Current.UtcNow - block_received_time; + // Include the consensus time into the consensus intervals. + var diff = TimeProvider.Current.UtcNow - onPrepareReceivedTime; if (diff >= span) span = TimeSpan.Zero; else