Skip to content
Open
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
11 changes: 10 additions & 1 deletion docs/tokens/how-to-issue-an-asset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,9 @@ package main

import (
"context"
"errors"
"log"
"time"

"github.com/stellar/go-stellar-sdk/clients/rpcclient"
"github.com/stellar/go-stellar-sdk/keypair"
Expand All @@ -777,7 +779,14 @@ func submit(ctx context.Context, client *rpcclient.Client, tx *txnbuild.Transact
log.Fatalf("Submission failed: %s", sendResp.Status)
}

finalResp, err := client.PollTransaction(ctx, sendResp.Hash)
// PollTransaction keeps polling until the context times out.
pollCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
finalResp, err := client.PollTransaction(pollCtx, sendResp.Hash)
if errors.Is(err, context.DeadlineExceeded) {
// Still NOT_FOUND: the status is unknown, not failed.
log.Fatalf("Status unknown, look up %s again later", sendResp.Hash)
}
if err != nil {
log.Fatal(err)
}
Expand Down