diff --git a/fsm.go b/fsm.go index 06ba11354..43be0077c 100644 --- a/fsm.go +++ b/fsm.go @@ -6,17 +6,18 @@ import ( "reflect" "time" - "github.com/filecoin-project/specs-actors/actors/abi" "golang.org/x/xerrors" + "github.com/filecoin-project/go-statemachine" + "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/lib/statemachine" ) -func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface{}, error) { +func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface{}, uint64, error) { next, err := m.plan(events, user.(*SectorInfo)) if err != nil || next == nil { - return nil, err + return nil, 0, err } return func(ctx statemachine.Context, si SectorInfo) error { @@ -27,7 +28,7 @@ func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface } return nil - }, nil + }, uint64(len(events)), nil // TODO: This processed event count is not very correct } var fsmPlanners = []func(events []statemachine.Event, state *SectorInfo) error{ diff --git a/fsm_test.go b/fsm_test.go index a4d53d018..41becc4f3 100644 --- a/fsm_test.go +++ b/fsm_test.go @@ -6,8 +6,9 @@ import ( logging "github.com/ipfs/go-log/v2" "github.com/stretchr/testify/require" + "github.com/filecoin-project/go-statemachine" + "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/lib/statemachine" ) func init() { diff --git a/sealing.go b/sealing.go index a3652485e..89294eb91 100644 --- a/sealing.go +++ b/sealing.go @@ -12,6 +12,7 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-padreader" + "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/crypto" @@ -20,7 +21,6 @@ import ( "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/lib/statemachine" "github.com/filecoin-project/lotus/storage/sealmgr" ) diff --git a/states.go b/states.go index b083096e9..e12860447 100644 --- a/states.go +++ b/states.go @@ -5,6 +5,7 @@ import ( "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin/miner" @@ -14,7 +15,6 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/lib/statemachine" ) func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) error { diff --git a/states_failed.go b/states_failed.go index a7dfe36a9..d5667f57e 100644 --- a/states_failed.go +++ b/states_failed.go @@ -4,6 +4,7 @@ import ( "bytes" "time" + "github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/util/adt" "golang.org/x/xerrors" @@ -12,7 +13,6 @@ import ( "github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/lib/statemachine" ) const minRetryTime = 1 * time.Minute