Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return true when deadlines changed #4403

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions chain/actors/builtin/miner/diff_deadlines.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/filecoin-project/go-state-types/exitcode"
)

type DeadlinesDiff map[uint64]*DeadlineDiff
type DeadlinesDiff map[uint64]DeadlineDiff

func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
func DiffDeadlines(pre, cur State) (DeadlinesDiff, error) {
changed, err := pre.DeadlinesChanged(cur)
if err != nil {
return nil, err
Expand All @@ -18,11 +18,7 @@ func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
return nil, nil
}

numDl, err := pre.NumDeadlines()
if err != nil {
return nil, err
}
dlDiff := make(DeadlinesDiff, numDl)
dlDiff := make(DeadlinesDiff)
if err := pre.ForEachDeadline(func(idx uint64, preDl Deadline) error {
curDl, err := cur.LoadDeadline(idx)
if err != nil {
Expand All @@ -39,12 +35,12 @@ func DiffDeadlines(pre, cur State) (*DeadlinesDiff, error) {
}); err != nil {
return nil, err
}
return &dlDiff, nil
return dlDiff, nil
}

type DeadlineDiff map[uint64]*PartitionDiff

func DiffDeadline(pre, cur Deadline) (*DeadlineDiff, error) {
func DiffDeadline(pre, cur Deadline) (DeadlineDiff, error) {
changed, err := pre.PartitionsChanged(cur)
if err != nil {
return nil, err
Expand Down Expand Up @@ -104,7 +100,7 @@ func DiffDeadline(pre, cur Deadline) (*DeadlineDiff, error) {
return nil, err
}

return &partDiff, nil
return partDiff, nil
}

type PartitionDiff struct {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/miner/v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *state0) DeadlinesChanged(other State) (bool, error) {
return true, nil
}

return s.State.Deadlines.Equals(other0.Deadlines), nil
return !s.State.Deadlines.Equals(other0.Deadlines), nil
}

func (s *state0) Info() (MinerInfo, error) {
Expand Down Expand Up @@ -370,7 +370,7 @@ func (d *deadline0) PartitionsChanged(other Deadline) (bool, error) {
return true, nil
}

return d.Deadline.Partitions.Equals(other0.Deadline.Partitions), nil
return !d.Deadline.Partitions.Equals(other0.Deadline.Partitions), nil
}

func (d *deadline0) PostSubmissions() (bitfield.BitField, error) {
Expand Down
4 changes: 2 additions & 2 deletions chain/actors/builtin/miner/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (s *state2) DeadlinesChanged(other State) (bool, error) {
return true, nil
}

return s.State.Deadlines.Equals(other2.Deadlines), nil
return !s.State.Deadlines.Equals(other2.Deadlines), nil
}

func (s *state2) Info() (MinerInfo, error) {
Expand Down Expand Up @@ -369,7 +369,7 @@ func (d *deadline2) PartitionsChanged(other Deadline) (bool, error) {
return true, nil
}

return d.Deadline.Partitions.Equals(other2.Deadline.Partitions), nil
return !d.Deadline.Partitions.Equals(other2.Deadline.Partitions), nil
}

func (d *deadline2) PostSubmissions() (bitfield.BitField, error) {
Expand Down