sealing: fix lint issues

This commit is contained in:
Łukasz Magiera 2022-03-16 20:28:15 +01:00
parent 2961f3b864
commit 3b2a1ea41d
3 changed files with 10 additions and 9 deletions

View File

@ -575,8 +575,8 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
continue continue
} }
slowChecks := func() bool { slowChecks := func(sid abi.SectorNumber) bool {
active, err := m.sectorActive(ctx, TipSetToken{}, s.Number) active, err := m.sectorActive(ctx, TipSetToken{}, sid)
if err != nil { if err != nil {
log.Errorw("checking sector active", "error", err) log.Errorw("checking sector active", "error", err)
return false return false
@ -592,7 +592,7 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
// if best is above target, we want lower pledge, but only if still above target // if best is above target, we want lower pledge, but only if still above target
if bestExpiration < targetExpiration { if bestExpiration < targetExpiration {
if expiration > bestExpiration && slowChecks() { if expiration > bestExpiration && slowChecks(s.Number) {
bestExpiration = expiration bestExpiration = expiration
bestPledge = pledge bestPledge = pledge
candidate = s candidate = s
@ -600,7 +600,7 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
continue continue
} }
if expiration >= targetExpiration && pledge.LessThan(bestPledge) && slowChecks() { if expiration >= targetExpiration && pledge.LessThan(bestPledge) && slowChecks(s.Number) {
bestExpiration = expiration bestExpiration = expiration
bestPledge = pledge bestPledge = pledge
candidate = s candidate = s

View File

@ -2,11 +2,11 @@ package sealing
import ( import (
"context" "context"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
) )
func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) error { func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) error {

View File

@ -4,19 +4,20 @@ package itests
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/filecoin-project/lotus/api"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"testing" "testing"
"time" "time"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit"
) )
func TestCCUpgrade(t *testing.T) { func TestCCUpgrade(t *testing.T) {