@@ -20,7 +20,7 @@ import Cardano.DbSync.Api
20
20
import Cardano.DbSync.Api.Types (InsertOptions (.. ), SyncEnv (.. ))
21
21
import Cardano.DbSync.Cache.Types (Cache (.. ))
22
22
23
- import Cardano.DbSync.Config.Types (MetadataConfig (.. ), MultiAssetConfig (.. ), PlutusConfig (.. ), ShelleyInsertConfig (.. ), isPlutusModeActive , isShelleyModeActive )
23
+ import Cardano.DbSync.Config.Types (MetadataConfig (.. ), MultiAssetConfig (.. ), PlutusConfig (.. ), ShelleyInsertConfig (.. ), isPlutusModeActive , isShelleyModeActive , isShelleyWhitelistModeActive )
24
24
import qualified Cardano.DbSync.Era.Shelley.Generic as Generic
25
25
import Cardano.DbSync.Era.Shelley.Generic.Metadata (TxMetadataValue (.. ), metadataValueToJsonNoSchema )
26
26
import Cardano.DbSync.Era.Universal.Insert.Certificate (insertCertificate )
@@ -95,13 +95,18 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
95
95
else
96
96
let ! inSum = sum $ map unDbLovelace $ catMaybes amounts
97
97
in pure (resolvedInputs, fees, Just $ fromIntegral (inSum + withdrawalSum) - fromIntegral outSum - fromIntegral fees)
98
+ -- Nothing in fees means a phase 2 failure
98
99
(_, _, Nothing ) -> do
99
- -- Nothing in fees means a phase 2 failure
100
- (resolvedInsFull, amounts) <- splitLast <$> mapM (resolveTxInputs syncEnv hasConsumed True (fst <$> groupedTxOut grouped)) (Generic. txInputs tx)
101
- let ! inSum = sum $ map unDbLovelace $ catMaybes amounts
102
- ! diffSum = if inSum >= outSum then inSum - outSum else 0
103
- ! fees = maybe diffSum (fromIntegral . unCoin) (Generic. txFees tx)
104
- pure (resolvedInsFull, fromIntegral fees, Just 0 )
100
+ -- If we are in shelley whitelist mode, we don't need to resolve the tx inputs for this case.
101
+ if isShelleyWhitelistModeActive $ ioShelley $ getInsertOptions syncEnv
102
+ then -- TODO: cmdv -- would this be the right values to return?
103
+ pure ([] , 0 , Just 0 )
104
+ else do
105
+ (resolvedInsFull, amounts) <- splitLast <$> mapM (resolveTxInputs syncEnv hasConsumed True (fst <$> groupedTxOut grouped)) (Generic. txInputs tx)
106
+ let ! inSum = sum $ map unDbLovelace $ catMaybes amounts
107
+ ! diffSum = if inSum >= outSum then inSum - outSum else 0
108
+ ! fees = maybe diffSum (fromIntegral . unCoin) (Generic. txFees tx)
109
+ pure (resolvedInsFull, fromIntegral fees, Just 0 )
105
110
let fees = fromIntegral fees'
106
111
-- Insert transaction and get txId from the DB.
107
112
! txId <-
0 commit comments