From 14762ab26b67e768a0967929014a6b8eb83e397f Mon Sep 17 00:00:00 2001 From: PJ Date: Thu, 26 Sep 2024 13:22:39 +0200 Subject: [PATCH] gouging: only assert TxnFeeMaxRecommended if max contract price is not zero --- internal/gouging/gouging.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/gouging/gouging.go b/internal/gouging/gouging.go index aadfdd57f..28387de18 100644 --- a/internal/gouging/gouging.go +++ b/internal/gouging/gouging.go @@ -216,9 +216,9 @@ func checkPriceGougingPT(gs api.GougingSettings, cs api.ConsensusState, txnFee t } } - // check TxnFeeMaxRecommended - expect at most a multiple of our fee - if !txnFee.IsZero() && pt.TxnFeeMaxRecommended.Cmp(txnFee.Mul64(5)) > 0 { - return fmt.Errorf("TxnFeeMaxRecommended %v exceeds %v", pt.TxnFeeMaxRecommended, txnFee.Mul64(5)) + // check TxnFeeMaxRecommended - expect it to be lower or equal than the max contract price + if !gs.MaxContractPrice.IsZero() && pt.TxnFeeMaxRecommended.Mul64(4096).Cmp(gs.MaxContractPrice) > 0 { + return fmt.Errorf("TxnFeeMaxRecommended %v exceeds %v", pt.TxnFeeMaxRecommended, gs.MaxContractPrice.Div64(4096)) } // check TxnFeeMinRecommended - expect it to be lower or equal than the max