Skip to content

Commit 8124152

Browse files
committed
pool: update client subscription state before responding.
This fixes a bug where the subscription state would be out of sync with the client because the response was getting sent before the state was updated.
1 parent b6829cb commit 8124152

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pool/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,12 @@ func (c *Client) handleSubscribeRequest(req *Request, allowed bool) error {
333333
resp = SubscribeResponse(*req.ID, nid, c.extraNonce1, ExtraNonce2Size, nil)
334334
}
335335

336-
c.ch <- resp
337336
c.subscribedMtx.Lock()
338337
c.subscribed = true
339338
c.subscribedMtx.Unlock()
340339

340+
c.ch <- resp
341+
341342
return nil
342343
}
343344

0 commit comments

Comments
 (0)