From 551bfcc88580ccd4ad8e905a350bedbd3847275f Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Wed, 18 Dec 2024 14:47:55 +0100 Subject: [PATCH] logging --- autopilot/contractor/contractor.go | 1 + autopilot/contractor/hostfilter.go | 2 ++ bus/routes.go | 1 + stores/metadata.go | 1 + 4 files changed, 5 insertions(+) diff --git a/autopilot/contractor/contractor.go b/autopilot/contractor/contractor.go index b452a21c4..89e003917 100644 --- a/autopilot/contractor/contractor.go +++ b/autopilot/contractor/contractor.go @@ -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") } diff --git a/autopilot/contractor/hostfilter.go b/autopilot/contractor/hostfilter.go index 473097f25..112308318 100644 --- a/autopilot/contractor/hostfilter.go +++ b/autopilot/contractor/hostfilter.go @@ -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", contract.RemainingCollateral(), MinCollateral, contract.ContractPrice, contract.Revision.MissedHostValue) } 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()) diff --git a/bus/routes.go b/bus/routes.go index 04853a49c..d84ffdf5b 100644 --- a/bus/routes.go +++ b/bus/routes.go @@ -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) diff --git a/stores/metadata.go b/stores/metadata.go index 4600de108..92c93faad 100644 --- a/stores/metadata.go +++ b/stores/metadata.go @@ -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