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/go.mod b/go.mod index 5998dc60d..abae1d47e 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/montanaflynn/stats v0.7.1 github.com/shopspring/decimal v1.4.0 go.sia.tech/core v0.8.1-0.20241217152409-7950a7ca324b - go.sia.tech/coreutils v0.8.1-0.20241218134231-af7c48b09fd7 + go.sia.tech/coreutils v0.8.1-0.20241218140128-03c2825e135b go.sia.tech/gofakes3 v0.0.5 go.sia.tech/hostd v1.1.3-0.20241218083322-ae9c8a971fe0 go.sia.tech/jape v0.12.1 diff --git a/go.sum b/go.sum index 46fd86742..a8d8d1696 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.sia.tech/core v0.8.1-0.20241217152409-7950a7ca324b h1:VRkb6OOX1KawLQwuqOEHLcjha8gxVX0tAyu2Dyoq8Ek= go.sia.tech/core v0.8.1-0.20241217152409-7950a7ca324b/go.mod h1:Wj1qzvpMM2rqEQjwWJEbCBbe9VWX/mSJUu2Y2ABl1QA= -go.sia.tech/coreutils v0.8.1-0.20241218134231-af7c48b09fd7 h1:slR3kyySkOXpOC9cslU8jPgs8FXrapaCad80QyCx8UY= -go.sia.tech/coreutils v0.8.1-0.20241218134231-af7c48b09fd7/go.mod h1:xhIbFjjkzmCF8Dt73ZvquaBQCT2Dje7AKYBRAesn93w= +go.sia.tech/coreutils v0.8.1-0.20241218140128-03c2825e135b h1:DIprjP9Q+8LCpW927i4AgMed717e8nHILj+yjFJ2Nv4= +go.sia.tech/coreutils v0.8.1-0.20241218140128-03c2825e135b/go.mod h1:xhIbFjjkzmCF8Dt73ZvquaBQCT2Dje7AKYBRAesn93w= go.sia.tech/gofakes3 v0.0.5 h1:vFhVBUFbKE9ZplvLE2w4TQxFMQyF8qvgxV4TaTph+Vw= go.sia.tech/gofakes3 v0.0.5/go.mod h1:LXEzwGw+OHysWLmagleCttX93cJZlT9rBu/icOZjQ54= go.sia.tech/hostd v1.1.3-0.20241218083322-ae9c8a971fe0 h1:QtF8l+pHZq6gPyDyuQoMv8GdwU6lvz39y4I34S3cuvo= 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