Skip to content

Commit

Permalink
f3: Keep single node longer term
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Oct 22, 2024
1 parent bb46ed3 commit e521ffd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tasks/f3/f3_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func NewF3Task(db *harmonydb.DB, api F3ParticipationAPI, actors map[dtypes.Miner
}

func (f *F3Task) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error) {
ctx := context.Background()
// Ensure that all chain calls are made on the same node (the first call will determine the node)
ctx := deps.OnSingleNode(context.Background())

var spID int64
err = f.db.QueryRow(ctx, "SELECT sp_id FROM f3_tasks WHERE task_id = $1", taskID).Scan(&spID)
Expand All @@ -82,16 +83,12 @@ func (f *F3Task) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done boo
}

for stillOwned() {

var previousTicket []byte
err = f.db.QueryRow(ctx, "SELECT previous_ticket FROM f3_tasks WHERE task_id = $1", taskID).Scan(&previousTicket)
if err != nil {
return false, xerrors.Errorf("failed to get previous ticket: %w", err)
}

// Ensure that calls are made on the same node (the first call will determine the node)
ctx := deps.OnSingleNode(ctx)

ticket, err := f.tryGetF3ParticipationTicket(ctx, stillOwned, maddr, previousTicket)
if err != nil {
return false, xerrors.Errorf("failed to get participation ticket: %w", err)
Expand Down

0 comments on commit e521ffd

Please sign in to comment.