Skip to content

Commit

Permalink
offline: check for our turn
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Mar 14, 2023
1 parent 9667ba5 commit 7c7ae3f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/kzgcli/offline_sendcontribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,22 @@ var offlineSendContributionCmd = &cobra.Command{
log.Fatalf("creating sequencer client: %s", err)
}

fmt.Printf("Sending contribution %s to the sequencer...\n", args[0])
for {
_, ok, err := client.TryContribute(cmd.Context(), sessionID)
if err != nil {
fmt.Printf("%v Waiting for our turn failed (err: %s), retrying in %v...\n", time.Now().Format("2006-01-02 15:04:05"), err, tryContributeAttemptDelay)
time.Sleep(tryContributeAttemptDelay)
continue
}
if !ok {
fmt.Printf("%v Can't enter the lobby, are you sure we're on your reserved slot? Waiting %v for retrying...\n", time.Now().Format("2006-01-02 15:04:05"), tryContributeAttemptDelay)
time.Sleep(tryContributeAttemptDelay)
continue
}
break
}

fmt.Printf("Sending our precomputed contribution %s to the sequencer...\n", args[0])
var contributionReceipt *sequencerclient.ContributionReceipt
for {
var err error
Expand Down

0 comments on commit 7c7ae3f

Please sign in to comment.