diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs index d414f9c22e..5342b270bc 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs @@ -353,11 +353,13 @@ convToTxProposalProcedures :: Ledger.EraPParams (ShelleyLedgerEra era) => [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] -> TxProposalProcedures BuildTx era -convToTxProposalProcedures proposalProcedures = +convToTxProposalProcedures proposalProcedures = do -- TODO: Ledger does not export snoc so we can't fold here. let proposals = OSet.fromFoldable $ map (unProposal . fst) proposalProcedures - sWitMap = BuildTxWith $ foldl sWitMapFolder Map.empty proposalProcedures - in TxProposalProcedures proposals sWitMap + case Map.size sWitMap of + 0 -> error "convToTxProposalProcedures: No script witness found for proposal." + _ -> TxProposalProcedures proposals $ BuildTxWith sWitMap where + sWitMap = foldl sWitMapFolder Map.empty proposalProcedures sWitMapFolder sWitMapAccum nextSWit = sWitMapAccum `Map.union` uncurry proposingScriptWitnessSingleton nextSWit