From 97be687316af2726cc945482836ae62d0085cd49 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Fri, 16 Feb 2024 11:37:03 -0600 Subject: [PATCH] Debug tx proposal script witness --- .../src/Cardano/CLI/Types/Errors/TxValidationError.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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