Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiao Jin committed Feb 2, 2021
1 parent 9692809 commit 2354dfd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/neo/Network/P2P/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ private void OnNewTasks(InvPayload payload)
private void OnPersistCompleted(Block block)
{
foreach (var (actor, session) in sessions)
if (session.ReceivedBlock.Remove(block.Index, out Block receivedBlock) && block.Hash == receivedBlock.Hash)
RequestTasks(actor, session);
if (session.ReceivedBlock.Remove(block.Index, out Block receivedBlock))
{
if (block.Hash == receivedBlock.Hash)
RequestTasks(actor, session);
else
actor.Tell(Tcp.Abort.Instance);
}
}

protected override void OnReceive(object message)
Expand Down

0 comments on commit 2354dfd

Please sign in to comment.