Commit 3ec48906 authored by muXxer's avatar muXxer

Fixed raise condition in close channel

parent 699c4a6c
......@@ -186,15 +186,18 @@ func (client *PowClient) PowFunc(trytes trinary.Trytes, minWeightMagnitude int,
client.outgoingReq <- pendingPowRequest
select {
case powResponse := <-pendingPowRequest.powResponseChan:
// Got response
close(pendingPowRequest.powResponseChan)
result, err := trinary.NewTrytes(powResponse.Nonce)
if err != nil {
return "", err
}
case powResponse, hasMore := <-pendingPowRequest.powResponseChan:
if hasMore {
// Got response
close(pendingPowRequest.powResponseChan)
result, err := trinary.NewTrytes(powResponse.Nonce)
if err != nil {
return "", err
}
return result, err
return result, err
}
return "", errors.New("powResponseChan was closed")
case <-time.After(time.Duration(client.ReadTimeOutMs) * time.Millisecond):
// Timeout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment