@@ -56,6 +56,7 @@ import Cardano.DbSync.Era.Universal.Insert.Pool (IsPoolMember)
5656import Cardano.DbSync.Era.Util (safeDecodeToJson )
5757import Cardano.DbSync.Error (SyncNodeError )
5858import Cardano.DbSync.Ledger.Types (ApplyResult (.. ), getGovExpiresAt , lookupDepositsMap )
59+ import Cardano.DbSync.Types (BlockEra )
5960import Cardano.DbSync.Util
6061import Cardano.DbSync.Util.Cbor (serialiseTxMetadataToCbor )
6162
@@ -72,8 +73,9 @@ insertTx ::
7273 Word64 ->
7374 Generic. Tx ->
7475 BlockGroupedData ->
76+ BlockEra ->
7577 ExceptT SyncNodeError DB. DbM BlockGroupedData
76- insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped = do
78+ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped era = do
7779 let ! txHash = Generic. txHash tx
7880 let ! mdeposits = if not (Generic. txValidContract tx) then Just (Coin 0 ) else lookupDepositsMap txHash (apDepositsMap applyResult)
7981 let ! outSum = fromIntegral $ unCoin $ Generic. txOutSum tx
@@ -140,7 +142,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
140142
141143 if not (Generic. txValidContract tx)
142144 then do
143- ! txOutsGrouped <- mapM (insertTxOut syncEnv iopts (txId, txHash)) (Generic. txOutputs tx)
145+ ! txOutsGrouped <- mapM (\ txOut -> insertTxOut syncEnv iopts (txId, txHash) txOut era ) (Generic. txOutputs tx)
144146
145147 let ! txIns = map (prepareTxIn txId Map. empty) resolvedInputs
146148 -- There is a custom semigroup instance for BlockGroupedData which uses addition for the values `fees` and `outSum`.
@@ -149,7 +151,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
149151 else do
150152 -- The following operations only happen if the script passes stage 2 validation (or the tx has
151153 -- no script).
152- ! txOutsGrouped <- mapM (insertTxOut syncEnv iopts (txId, txHash)) (Generic. txOutputs tx)
154+ ! txOutsGrouped <- mapM (\ txOut -> insertTxOut syncEnv iopts (txId, txHash) txOut era ) (Generic. txOutputs tx)
153155
154156 ! redeemers <-
155157 Map. fromList
@@ -161,7 +163,7 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
161163 mapM_ (insertDatum syncEnv txId) (Generic. txData tx)
162164 mapM_ (insertCollateralTxIn syncEnv tracer txId) (Generic. txCollateralInputs tx)
163165 mapM_ (insertReferenceTxIn syncEnv tracer txId) (Generic. txReferenceInputs tx)
164- mapM_ (insertCollateralTxOut syncEnv iopts (txId, txHash)) (Generic. txCollateralOutputs tx)
166+ mapM_ (\ txOut -> insertCollateralTxOut syncEnv iopts (txId, txHash) txOut era ) (Generic. txCollateralOutputs tx)
165167
166168 txMetadata <-
167169 whenFalseMempty (ioMetadata iopts) $
@@ -213,9 +215,10 @@ insertTxOut ::
213215 InsertOptions ->
214216 (DB. TxId , ByteString ) ->
215217 Generic. TxOut ->
218+ BlockEra ->
216219 ExceptT SyncNodeError DB. DbM (ExtendedTxOut , [MissingMaTxOut ])
217- insertTxOut syncEnv iopts (txId, txHash) (Generic. TxOut index addr value maMap mScript dt) = do
218- mSaId <- insertStakeAddressRefIfMissing syncEnv addr
220+ insertTxOut syncEnv iopts (txId, txHash) (Generic. TxOut index addr value maMap mScript dt) era = do
221+ mSaId <- insertStakeAddressRefIfMissing syncEnv addr era
219222 mDatumId <-
220223 whenFalseEmpty (ioPlutusExtra iopts) Nothing $
221224 Generic. whenInlineDatum dt $
@@ -387,9 +390,10 @@ insertCollateralTxOut ::
387390 InsertOptions ->
388391 (DB. TxId , ByteString ) ->
389392 Generic. TxOut ->
393+ BlockEra ->
390394 ExceptT SyncNodeError DB. DbM ()
391- insertCollateralTxOut syncEnv iopts (txId, _txHash) (Generic. TxOut index addr value maMap mScript dt) = do
392- mSaId <- insertStakeAddressRefIfMissing syncEnv addr
395+ insertCollateralTxOut syncEnv iopts (txId, _txHash) (Generic. TxOut index addr value maMap mScript dt) era = do
396+ mSaId <- insertStakeAddressRefIfMissing syncEnv addr era
393397 mDatumId <-
394398 whenFalseEmpty (ioPlutusExtra iopts) Nothing $
395399 Generic. whenInlineDatum dt $
0 commit comments