good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 62cd943c authored by Gary Rong's avatar Gary Rong Committed by GitHub
Browse files

les: fix dead lock (#20828)

parent d6c5f241
No related branches found
No related tags found
No related merge requests found
......@@ -531,8 +531,6 @@ func (p *serverPeer) getTxRelayCost(amount, size int) uint64 {
// HasBlock checks if the peer has a given block
func (p *serverPeer) HasBlock(hash common.Hash, number uint64, hasState bool) bool {
p.lock.RLock()
defer p.lock.RUnlock()
head := p.headInfo.Number
var since, recent uint64
if hasState {
......@@ -543,6 +541,7 @@ func (p *serverPeer) HasBlock(hash common.Hash, number uint64, hasState bool) bo
recent = p.chainRecent
}
hasBlock := p.hasBlock
p.lock.RUnlock()
return head >= number && number >= since && (recent == 0 || number+recent+4 > head) && hasBlock != nil && hasBlock(hash, number, hasState)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment