Skip to content

Commit

Permalink
gouging: only assert TxnFeeMaxRecommended if max contract price is no…
Browse files Browse the repository at this point in the history
…t zero
  • Loading branch information
peterjan authored and ChrisSchinnerl committed Sep 29, 2024
1 parent 6ec5143 commit 14762ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/gouging/gouging.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14762ab

Please sign in to comment.