@@ -33,7 +33,7 @@ import Cardano.Ledger.Api (
33
33
unRedeemers ,
34
34
witsTxL ,
35
35
)
36
- import Cardano.Ledger.BaseTypes (StrictMaybe (.. ))
36
+ import Cardano.Ledger.BaseTypes (StrictMaybe (.. ), fromSMaybe )
37
37
import Control.Lens ((.~) , (<>~) , (^.) )
38
38
import Data.Aeson qualified as Aeson
39
39
import Data.ByteString qualified as BS
@@ -255,7 +255,7 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput,
255
255
& bodyTxL . referenceInputsTxBodyL <>~ Set. fromList [toLedgerTxIn initialScriptRef]
256
256
& bodyTxL . outputsTxBodyL .~ StrictSeq. singleton (toLedgerTxOut commitOutput)
257
257
& bodyTxL . reqSignerHashesTxBodyL <>~ Set. singleton (toLedgerKeyHash vkh)
258
- & bodyTxL . auxDataHashTxBodyL .~ SJust (hashAlonzoTxAuxData txAuxMetadata)
258
+ & bodyTxL . auxDataHashTxBodyL .~ combinedMetadata
259
259
& bodyTxL . mintTxBodyL .~ mempty
260
260
& auxDataTxL .~ addMetadata txAuxMetadata
261
261
existingWits = toLedgerTx blueprintTx ^. witsTxL
@@ -338,6 +338,12 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput,
338
338
TxMetadata commitMetadataMap = commitMetadata
339
339
340
340
txAuxMetadata = mkAlonzoTxAuxData @ [] @ LedgerEra (toShelleyMetadata commitMetadataMap) []
341
+
342
+ combinedMetadata =
343
+ let existingMetadataMap = fromSMaybe mempty $ getAuxMetadata <$> toLedgerTx blueprintTx ^. auxDataTxL
344
+ in SJust . hashAlonzoTxAuxData $
345
+ mkAlonzoTxAuxData @ [] @ LedgerEra (Map. union (toShelleyMetadata commitMetadataMap) existingMetadataMap) []
346
+
341
347
CommitBlueprintTx {lookupUTxO, blueprintTx} = commitBlueprintTx
342
348
343
349
commitMetadata :: TxMetadata
0 commit comments