Skip to content

Commit

Permalink
pool: Add missing response to subscribe handler.
Browse files Browse the repository at this point in the history
The handler for subscribe requests seemed to have incomplete error
handling for the case where FetchMinerDifficulty failed. No response was
being returned to the caller.

This adds a generic Unknown error response so that the caller is not
left hanging.
  • Loading branch information
jholdstock authored and davecgh committed Sep 15, 2023
1 parent 97c3a47 commit de42b07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pool/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ func (c *Client) handleSubscribeRequest(req *Request, allowed bool) error {
info, err := c.cfg.FetchMinerDifficulty(miner)
if err != nil {
c.mtx.Unlock()
sErr := NewStratumError(Unknown, err)
resp := SubscribeResponse(*req.ID, "", "", 0, sErr)
c.sendMessage(resp)
return err
}
c.miner = miner
Expand Down

0 comments on commit de42b07

Please sign in to comment.