Skip to content

Commit

Permalink
Update maxRevisionCost check to match the way hostd computes LatestRe…
Browse files Browse the repository at this point in the history
…visionCost (#1112)

`hostd` uses `latestRevisionCost = settings.BaseRPCPrice + 2028 bytes
egress`

so this PR updates `renterd` to use
`maxLatestRevisionCost = maxRPCPrice + 2048 bytes MaxDownloadPrice`
  • Loading branch information
ChrisSchinnerl authored Mar 27, 2024
2 parents 83c9369 + aaab735 commit 82246d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion worker/gouging.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ func checkPriceGougingPT(gs api.GougingSettings, cs api.ConsensusState, txnFee t
}

// check LatestRevisionCost - expect sane value
maxRevisionCost := gs.MaxDownloadPrice.Div64(1 << 40).Mul64(4096)
maxRevisionCost, overflow := gs.MaxRPCPrice.AddWithOverflow(gs.MaxDownloadPrice.Div64(1 << 40).Mul64(2048))
if overflow {
maxRevisionCost = types.MaxCurrency
}
if pt.LatestRevisionCost.Cmp(maxRevisionCost) > 0 {
return fmt.Errorf("LatestRevisionCost of %v exceeds maximum cost of %v", pt.LatestRevisionCost, maxRevisionCost)
}
Expand Down

0 comments on commit 82246d9

Please sign in to comment.