Skip to content

Commit

Permalink
autopilot: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Dec 12, 2023
1 parent 4ad17ae commit bf7eb41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autopilot/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1394,13 +1394,13 @@ func (c *contractor) renewContract(ctx context.Context, w Worker, ci contractInf
*budget = budget.Sub(renterFunds)

// persist the contract
newCollateral := resp.Contract.Revision.MissedHostPayout().Sub(resp.ContractPrice)
renewedContract, err := c.ap.bus.AddRenewedContract(ctx, resp.Contract, resp.ContractPrice, renterFunds, cs.BlockHeight, fcid, api.ContractStatePending)
if err != nil {
c.logger.Errorw(fmt.Sprintf("renewal failed to persist, err: %v", err), "hk", hk, "fcid", fcid)
return api.ContractMetadata{}, false, err
}

newCollateral := resp.Contract.Revision.MissedHostPayout().Sub(resp.ContractPrice)
c.logger.Debugw(
"renewal succeeded",
"fcid", renewedContract.ID,
Expand Down Expand Up @@ -1472,14 +1472,14 @@ func (c *contractor) refreshContract(ctx context.Context, w Worker, ci contractI
*budget = budget.Sub(renterFunds)

// persist the contract
newCollateral := resp.Contract.Revision.MissedHostPayout().Sub(resp.ContractPrice)
refreshedContract, err := c.ap.bus.AddRenewedContract(ctx, resp.Contract, resp.ContractPrice, renterFunds, cs.BlockHeight, contract.ID, api.ContractStatePending)
if err != nil {
c.logger.Errorw("adding refreshed contract failed", zap.Error(err), "hk", hk, "fcid", fcid)
return api.ContractMetadata{}, false, err
}

// add to renewed set
newCollateral := resp.Contract.Revision.MissedHostPayout().Sub(resp.ContractPrice)
c.logger.Debugw("refresh succeeded",
"fcid", refreshedContract.ID,
"renewedFrom", contract.ID,
Expand Down

0 comments on commit bf7eb41

Please sign in to comment.