Skip to content

Commit

Permalink
rhp4: make input validation clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Sep 28, 2024
1 parent 48da7a3 commit 19326ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rhp/v4/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ func (s *Server) handleRPCFormContract(stream net.Conn) error {
cs := s.chain.TipState()
renterCost, hostCost := rhp4.ContractCost(cs, prices, formationTxn.FileContracts[0], formationTxn.MinerFee)
// validate the renter added enough inputs
if n := renterInputs.Cmp(renterCost); n < 0 {
if renterInputs.Cmp(renterCost) < 0 {
return errorBadRequest("renter funding %v is less than required funding %v", renterInputs, renterCost)
} else if n > 0 {
} else if !renterInputs.Equals(renterCost) {
// if the renter added too much, add a change output
formationTxn.SiacoinOutputs = append(formationTxn.SiacoinOutputs, types.SiacoinOutput{
Address: req.Contract.RenterAddress,
Expand Down

0 comments on commit 19326ed

Please sign in to comment.