Skip to content

Commit f8047f1

Browse files
committed
Resolve the issue of not being able to produce a block
1 parent 103ebda commit f8047f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/AElf.Kernel.Consensus.AEDPoS/Application/IrreversibleBlockHeightUnacceptableLogEventProcessor.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ protected override async Task ProcessLogEventAsync(Block block, LogEvent logEven
5151
var distanceToLib = new IrreversibleBlockHeightUnacceptable();
5252
distanceToLib.MergeFrom(logEvent);
5353

54-
if (distanceToLib.DistanceToIrreversibleBlockHeight > 0)
5554
{
55+
var chain = await _blockchainService.GetChainAsync();
5656
Logger.LogDebug($"Distance to lib height: {distanceToLib.DistanceToIrreversibleBlockHeight}");
57+
if ( block.Height - chain.LastIrreversibleBlockHeight < distanceToLib.DistanceToIrreversibleBlockHeight/2)
58+
{
59+
return;
60+
}
5761
Logger.LogDebug("Will rollback to lib height.");
5862
_taskQueueManager.Enqueue(
5963
async () =>
6064
{
61-
var chain = await _blockchainService.GetChainAsync();
6265
await _blockchainService.ResetChainToLibAsync(chain);
6366
}, KernelConstants.UpdateChainQueueName);
6467
}

0 commit comments

Comments
 (0)