From e521ffd0fe9b655610b88df943562e72d793396e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 22 Oct 2024 09:21:48 +0200 Subject: [PATCH] f3: Keep single node longer term --- tasks/f3/f3_task.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tasks/f3/f3_task.go b/tasks/f3/f3_task.go index 811116f6d..0e22e55bd 100644 --- a/tasks/f3/f3_task.go +++ b/tasks/f3/f3_task.go @@ -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) @@ -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)