les, light: add block availability check for ODR requests

This commit is contained in:
Zsolt Felfoldi
2016-12-10 06:50:36 +01:00
parent c57c54ce96
commit f12f8a6c14
7 changed files with 71 additions and 14 deletions

View File

@ -188,6 +188,9 @@ func (self *LesOdr) networkRequest(ctx context.Context, lreq LesOdrRequest) erro
var p *peer
if self.serverPool != nil {
p = self.serverPool.selectPeer(func(p *peer) (bool, uint64) {
if !lreq.CanSend(p) {
return false, 0
}
return true, p.fcServer.CanSend(lreq.GetCost(p))
})
}