fetchBlock :: Hash -> IO (Maybe Block)
fetchBlock h = do
  current <- getCurrentTime
  fR <- fetchRawBlock h
  fD <- fetchDifficulty
  case (fR, fD) of
    (Nothing, _) -> return Nothing
    (_, Nothing) -> return Nothing
    (Just rb, Just diff) -> do
      return $ Just
        $ Block
        { blockHash = rawBlockHash rb
        , blockDifficulty = diff
        , blockFee = rawBlockFee rb
        , blockHeight = rawBlockHeight rb
        , blockTime = rawBlockTime rb
        , blockCreatedAt = current
        }
fetchBlock :: Hash -> IO (Maybe Block)
fetchBlock h = do
  current <- getCurrentTime
  fR <- fetchRawBlock h
  fD <- fetchDifficulty
  case (fR, fD) of
    (Nothing, _) -> return Nothing
    (_, Nothing) -> return Nothing
    (Just rb, Just diff) -> do
      return $ Just
        $ Block
        { blockHash = rawBlockHash rb
        , blockDifficulty = diff
        , blockFee = rawBlockFee rb
        , blockHeight = rawBlockHeight rb
        , blockTime = rawBlockTime rb
        , blockCreatedAt = current
        }
fetchBlock h = do
  current <- getCurrentTime
  fR <- fetchRawBlock h
  fD <- fetchDifficulty
  case (fR, fD) of
    (Nothing, _) -> return Nothing
    (_, Nothing) -> return Nothing
    (Just rb, Just diff) -> do
      return $ Just
        $ Block
        { blockHash = rawBlockHash rb
        , blockDifficulty = diff
        , blockFee = rawBlockFee rb
        , blockHeight = rawBlockHeight rb
        , blockTime = rawBlockTime rb
        , blockCreatedAt = current
        }