fix: depth limit (#1451)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2022-07-12 12:24:58 +08:00
parent 9b7e8d70c8
commit b8b0fb1ba7
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
1 changed files with 3 additions and 4 deletions

View File

@ -283,10 +283,9 @@ func (s *scheduler) filterCandidateParents(peer *resource.Peer, blocklist set.Sa
return true
}
// Peer's depth exceeds limit depth.
peerDepth := peer.Depth()
if parentDepth+peerDepth > defaultDepthLimit {
peer.Log.Debugf("exceeds the %d depth limit of the tree, peer depth is %d, candidate parent %s is %d", defaultDepthLimit, peerDepth, candidateParent.ID, parentDepth)
// Parent's depth exceeds limit depth.
if parentDepth > defaultDepthLimit {
peer.Log.Debugf("exceeds the %d depth limit of the tree, candidate parent %s is %d", defaultDepthLimit, candidateParent.ID, parentDepth)
return true
}