Skip to content

Commit

Permalink
Merge pull request cgaebel#5 from GambolingPangolin/master
Browse files Browse the repository at this point in the history
fixes status code in generate rpc call
  • Loading branch information
wraithm authored Aug 26, 2019
2 parents 17af259 + 286a257 commit f630f02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Network/Bitcoin/Mining.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Network.Bitcoin.Wallet (getNewAddress)
import Network.HTTP.Client (HttpException (..),
HttpExceptionContent (..),
responseStatus)
import Network.HTTP.Types (status404)
import Network.HTTP.Types (status500)

-- | Returns whether or not bitcoind is generating bitcoins.
getGenerate :: Client -- ^ bitcoind RPC client
Expand Down Expand Up @@ -81,7 +81,7 @@ generate client blocks maxTries =
where
args = tj blocks : maybe [] (pure . tj) maxTries
onFail (HttpExceptionRequest _ (StatusCodeException rsp _))
| responseStatus rsp == status404
| responseStatus rsp == status500
= getNewAddress client Nothing >>= flip (generateToAddress client blocks) maxTries
onFail e = throw e

Expand Down

0 comments on commit f630f02

Please sign in to comment.