File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,18 @@ estimateBudget pabConf txFile = do
5656 pparams <- left toBudgetError pparamsRes
5757 maxUnits <- maybeToEither (BudgetEstimationError " Missing max units in parameters" ) $ protocolParamMaxTxExUnits pparams
5858
59- let scaledBudget = getScaledBudget maxUnits pabConf. pcBudgetMultiplier budget
59+ scaledBudget <- getScaledBudget maxUnits pabConf. pcBudgetMultiplier budget
6060
6161 (spendingBudgets, policyBudgets) <- mkBudgetMaps scaledBudget body
6262
6363 Right $ TxBudget spendingBudgets policyBudgets
6464
6565-- | Scale the budget clamping the total to the parameter limits
66- getScaledBudget :: CAPI. ExecutionUnits -> Rational -> ExUnitsMap -> ExUnitsMap
67- getScaledBudget maxUnits scaler budget = fmap (fmap $ scaleBudget scalers) budget
66+ getScaledBudget :: CAPI. ExecutionUnits -> Rational -> ExUnitsMap -> Either BudgetEstimationError ExUnitsMap
67+ getScaledBudget maxUnits scaler budget =
68+ if fst scalers >= 1 && snd scalers >= 1
69+ then Right $ fmap (fmap $ scaleBudget scalers) budget
70+ else Left $ BudgetEstimationError " Exceeded global transaction budget"
6871 where
6972 budgetSum = foldr addBudgets (CAPI. ExecutionUnits 0 0 ) $ rights $ Map. elems budget
7073 scalers =
You can’t perform that action at this time.
0 commit comments