• Sam Stokes's avatar
    op-node: prevent spamming of reqs for blocks triggered by `checkForGapInUnsafeQueue` (#10063) · 589b1fd2
    Sam Stokes authored
    * Add rangeReqId so we can cancel all associated block req via single flag
    
    * Use crypto/rand instead of math/rand for randomReqId
    
    * Use atomic counter instead of random num for rangeReqId
    
    * Remove redundant peerRequest.complete field. Use inFlight instead
    
    * Add mutex to activeRangeRequests map
    
    * Do not penalize peer for block not found error
    
    * Fix inFlight request clean up logic
    
    * Add test checks for cancelled range request
    
    * Add mutex protection to inFlight map
    
    * Use constants for ResultCode
    
    * Simplify inFlight.get method logic
    
    * Use same struct for activeRangeRequests and inFlight
    589b1fd2
node.go 9.92 KB