Skip to content

Commit

Permalink
1. Remove log and resolve issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chopin-fan committed Dec 19, 2024
1 parent c522ab9 commit 692c6b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ protected override async Task ProcessLogEventAsync(Block block, LogEvent logEven

if (distanceToLib.DistanceToIrreversibleBlockHeight > 0)
{
var chain = await _blockchainService.GetChainAsync();
Logger.LogDebug($"Distance to lib height: {distanceToLib.DistanceToIrreversibleBlockHeight}");
if ( block.Height - chain.LastIrreversibleBlockHeight < distanceToLib.DistanceToIrreversibleBlockHeight/2)
{
return;
}
Logger.LogDebug("Will rollback to lib height.");
_taskQueueManager.Enqueue(
async () =>
{
var chain = await _blockchainService.GetChainAsync();
await _blockchainService.ResetChainToLibAsync(chain);
}, KernelConstants.UpdateChainQueueName);
}
Expand Down
4 changes: 1 addition & 3 deletions src/AElf.Kernel/ConsensusRequestMiningEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public Task HandleEventAsync(ConsensusRequestMiningEventData eventData)
var chain = await _blockchainService.GetChainAsync();
if (eventData.PreviousBlockHash != chain.BestChainHash)
{
Logger.LogDebug($"PreviousBlockHash:{eventData.PreviousBlockHash},BestChainHash:{chain.BestChainHash},BestChainHeight:{chain.BestChainHeight},preHeight:{eventData.PreviousBlockHeight}");
await TriggerConsensusEventAsync(chain.BestChainHash, chain.BestChainHeight);
Logger.LogDebug("Mining canceled because best chain already updated 1");
Logger.LogDebug("Mining canceled because best chain already updated");
return;
}

Expand Down

0 comments on commit 692c6b2

Please sign in to comment.