Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Dec 18, 2024
1 parent ed2d909 commit e11f483
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions autopilot/contractor/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (c *Contractor) refreshContract(ctx *mCtx, contract contract, host api.Host
}

func (c *Contractor) renewContract(ctx *mCtx, contract contract, host api.Host, logger *zap.SugaredLogger) (cm api.ContractMetadata, proceed bool, err error) {
fmt.Println("contractor: renew")
if contract.Revision == nil {
return api.ContractMetadata{}, true, errors.New("can't renew contract without a revision")
}
Expand Down
2 changes: 2 additions & 0 deletions autopilot/contractor/hostfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ func (c *Contractor) isUsableContract(cfg api.AutopilotConfig, contract contract
usable = usable && contract.IsGood() && c.shouldForgiveFailedRefresh(contract.ID)
refresh = true
renew = false
fmt.Println("refresh, out of collateral")
}
if contract.IsOutOfFunds() {
reasons = append(reasons, errContractOutOfFunds.Error())
usable = usable && contract.IsGood() && c.shouldForgiveFailedRefresh(contract.ID)
refresh = true
renew = false
fmt.Println("refresh, out of funds")
}
if shouldRenew, secondHalf := isUpForRenewal(cfg, contract.EndHeight(), bh); shouldRenew {
reasons = append(reasons, fmt.Errorf("%w; second half: %t", errContractUpForRenewal, secondHalf).Error())
Expand Down
1 change: 1 addition & 0 deletions bus/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ func (b *Bus) contractIDRenewHandlerPOST(jc jape.Context) {
}

// add the renewal
fmt.Println("renew handler")
metadata, err := b.addRenewal(ctx, contract)
if jc.Check("couldn't add renewal", err) == nil {
jc.Encode(metadata)
Expand Down
1 change: 1 addition & 0 deletions stores/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (s *SQLStore) AddRenewal(ctx context.Context, c api.ContractMetadata) error
}

// reinsert renewed contract
fmt.Println("add renewal")
renewed.ArchivalReason = api.ContractArchivalReasonRenewed
renewed.RenewedTo = c.ID
renewed.Usability = api.ContractUsabilityBad
Expand Down

0 comments on commit e11f483

Please sign in to comment.