Closed vgonkivs closed 8 months ago
I have only one concern: we can request head from non-trusted peers, which means we don't guarantee that this particular peer will work as expected. Also, there is no punishment in the case when a peer does not respond at all and simply blocks the request. This malicious peer can hold 1-5-10-20 requests, so a lot of other "callers" will be blocked indefinitely.
It also won't be fixed when #149 is done because we can have 2-3 malicious peers in the peer tracker.
So, on the one hand, I agree with you that the caller should have the ability to not specify a timeout but from the other side, we are requesting 1 header that could not take more than even a minute + we are not requesting a particular height(which the node does not have). Every node has its own head and should serve it once it receives the request
closed in favour of https://github.com/celestiaorg/go-header/pull/152
Overview
Setting a default timeout, if it wasn't set, allows us to avoid any cases when the Head request could stuck.
Checklist