@@ -114,7 +114,7 @@ insertShelleyBlock syncEnv shouldLog withinTwoMins withinHalfHour blk details is
114114 }
115115
116116 let zippedTx = zip [0 .. ] (Generic. blkTxs blk)
117- let txInserter = insertTx tracer cache (getInsertOptions syncEnv) (getNetwork syncEnv) isMember blkId (sdEpochNo details) (Generic. blkSlotNo blk)
117+ let txInserter = insertTx syncEnv isMember blkId (sdEpochNo details) (Generic. blkSlotNo blk)
118118 grouped <- foldM (\ grouped (idx, tx) -> txInserter idx tx grouped) mempty zippedTx
119119 minIds <- insertBlockGroupedData syncEnv grouped
120120 when withinHalfHour $
@@ -211,10 +211,7 @@ insertOnNewEpoch tracer blkId slotNo epochNo newEpoch = do
211211
212212insertTx ::
213213 (MonadBaseControl IO m , MonadIO m ) =>
214- Trace IO Text ->
215- Cache ->
216- InsertOptions ->
217- Ledger. Network ->
214+ SyncEnv ->
218215 IsPoolMember ->
219216 DB. BlockId ->
220217 EpochNo ->
@@ -223,10 +220,11 @@ insertTx ::
223220 Generic. Tx ->
224221 BlockGroupedData ->
225222 ExceptT SyncNodeError (ReaderT SqlBackend m ) BlockGroupedData
226- insertTx tracer cache iopts network isMember blkId epochNo slotNo blockIndex tx grouped = do
223+ insertTx syncEnv isMember blkId epochNo slotNo blockIndex tx grouped = do
224+ hasConsumed <- liftIO $ getHasConsumed syncEnv
227225 let ! outSum = fromIntegral $ unCoin $ Generic. txOutSum tx
228226 ! withdrawalSum = fromIntegral $ unCoin $ Generic. txWithdrawalSum tx
229- ! resolvedInputs <- mapM (resolveTxInputs (fst <$> groupedTxOut grouped)) (Generic. txInputs tx)
227+ ! resolvedInputs <- mapM (resolveTxInputs hasConsumed (fst <$> groupedTxOut grouped)) (Generic. txInputs tx)
230228 let ! inSum = sum $ map (unDbLovelace . forth4) resolvedInputs
231229 let diffSum = if inSum >= outSum then inSum - outSum else 0
232230 let ! fees = maybe diffSum (fromIntegral . unCoin) (Generic. txFees tx)
@@ -295,6 +293,12 @@ insertTx tracer cache iopts network isMember blkId epochNo slotNo blockIndex tx
295293
296294 let ! txIns = map (prepareTxIn txId redeemers) resolvedInputs
297295 pure $ grouped <> BlockGroupedData txIns txOutsGrouped txMetadata maTxMint
296+ where
297+ tracer = getTrace syncEnv
298+ cache = envCache syncEnv
299+ iopts = getInsertOptions syncEnv
300+ network = getNetwork syncEnv
301+
298302
299303prepareTxOut ::
300304 (MonadBaseControl IO m , MonadIO m ) =>
0 commit comments