...
 
Commits (2)
......@@ -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
......