Skip to content

Commit

Permalink
fix sync (neo-project#2031)
Browse files Browse the repository at this point in the history
Co-authored-by: Shargon <shargon@gmail.com>
  • Loading branch information
2 people authored and cloud8little committed Jan 24, 2021
1 parent b835c1e commit fd575fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/neo/Network/P2P/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private void OnNewTasks(InvPayload payload)
private void OnPersistCompleted(Block block)
{
receivedBlockIndex.Remove(block.Index);
RequestTasks(false);
}

protected override void OnReceive(object message)
Expand Down Expand Up @@ -293,7 +294,7 @@ private void RequestTasks(bool sendPing)
var highestBlockIndex = sessions.Values.Max(p => p.LastBlockIndex);
for (; taskCounts < MaxSyncTasksCount; taskCounts++)
{
if (lastTaskIndex >= highestBlockIndex) break;
if (lastTaskIndex >= highestBlockIndex || lastTaskIndex >= Blockchain.Singleton.Height + InvPayload.MaxHashesCount) break;
if (!AssignSyncTask(++lastTaskIndex)) break;
}
}
Expand Down

0 comments on commit fd575fd

Please sign in to comment.