From 36b9a1ddbddf1477c61809d340cd0b86360a7a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 20 Dec 2020 21:47:22 +0100 Subject: Network: STM-based synchronization rewrite --- src/Pairing.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Pairing.hs') diff --git a/src/Pairing.hs b/src/Pairing.hs index a0a19b3..9af33c7 100644 --- a/src/Pairing.hs +++ b/src/Pairing.hs @@ -155,9 +155,9 @@ confirmationNumber dgst = let (a:b:c:d:_) = map fromIntegral $ BA.unpack dgst :: pairingRequest :: forall a m proxy. (PairingResult a, MonadIO m, MonadError String m) => proxy a -> UnifiedIdentity -> Peer -> m () pairingRequest _ self peer = do nonce <- liftIO $ getRandomBytes 32 - pid <- case peerIdentity peer of - PeerIdentityFull pid -> return pid - _ -> throwError "incomplete peer identity" + pid <- peerIdentity peer >>= \case + PeerIdentityFull pid -> return pid + _ -> throwError "incomplete peer identity" sendToPeerWith @(PairingService a) self peer $ \case NoPairing -> return (Just $ PairingRequest (nonceDigest self pid nonce BA.empty), OurRequest nonce) _ -> throwError "alredy in progress" -- cgit v1.2.3