...
 
Commits (2)
...@@ -186,15 +186,18 @@ func (client *PowClient) PowFunc(trytes trinary.Trytes, minWeightMagnitude int, ...@@ -186,15 +186,18 @@ func (client *PowClient) PowFunc(trytes trinary.Trytes, minWeightMagnitude int,
client.outgoingReq <- pendingPowRequest client.outgoingReq <- pendingPowRequest
select { select {
case powResponse := <-pendingPowRequest.powResponseChan: case powResponse, hasMore := <-pendingPowRequest.powResponseChan:
// Got response if hasMore {
close(pendingPowRequest.powResponseChan) // Got response
result, err := trinary.NewTrytes(powResponse.Nonce) close(pendingPowRequest.powResponseChan)
if err != nil { result, err := trinary.NewTrytes(powResponse.Nonce)
return "", err 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): case <-time.After(time.Duration(client.ReadTimeOutMs) * time.Millisecond):
// Timeout // Timeout
......