Correct logic for peer sync identification (#1525)

Fix a small sync bug which can mis-classify newly connected peers.
This commit is contained in:
Age Manning
2020-08-17 03:00:10 +00:00
parent 850a2d5985
commit afdc4fea1d
2 changed files with 51 additions and 22 deletions

View File

@@ -86,8 +86,8 @@ impl PeerSyncInfo {
// that we are within SLOT_IMPORT_TOLERANCE of our two heads
if (self.head_slot >= remote.head_slot
&& self.head_slot.sub(remote.head_slot).as_usize() <= SLOT_IMPORT_TOLERANCE)
|| (self.head_slot < remote.head_slot)
&& remote.head_slot.sub(self.head_slot).as_usize() <= SLOT_IMPORT_TOLERANCE
|| (self.head_slot < remote.head_slot
&& remote.head_slot.sub(self.head_slot).as_usize() <= SLOT_IMPORT_TOLERANCE)
{
return true;
}