From 78ceba78b4ead148745af75c02ba9125b5228185 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Thu, 16 May 2024 05:03:15 +0000 Subject: [PATCH] Use `when` in `validateWitnessCounts`. --- lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs b/lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs index f855cc7d8dd..88fdd84134b 100644 --- a/lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs +++ b/lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs @@ -3715,14 +3715,13 @@ validateWitnessCounts -> Int -- ^ detected number of key witnesses -> ExceptT ErrSubmitTransaction m () -validateWitnessCounts expected detected - | expected > detected = throwE $ +validateWitnessCounts expected detected = + when (expected > detected) $ throwE $ ErrSubmitTransactionMissingWitnesses $ ErrSubmitTransactionMissingWitnessCounts { expectedNumberOfKeyWits = toNatural expected , detectedNumberOfKeyWits = toNatural detected } - | otherwise = pure () where toNatural :: Int -> Natural toNatural = fromJustNote "validateWitnessCounts.toNatural" . intCastMaybe