// Call ethClient.TransactionByHash() repeatedly until the transaction is returned.
//
// count, total number of requests, should be greater than zero.
Call ethClient.TransactionByHash() repeatedly until the transaction is returned.

count, total number of requests, should be greater than zero.
// Call ethClient . TransactionByHash () repeatedly until the transaction is returned . // // count total number of requests should be greater than zero .
func TransactionByHashWithRetry(ethClient *ethclient.Client, txHash common.Hash, count int) (*types.Transaction, bool, error) {
	ctx := context.Background()
	var tx *types.Transaction
	var isPending bool
	var err error
	interval := 1 * time.Millisecond
	start := time.Now()
	for i := 0; i < count; i++ {
		tx, isPending, err = ethClient.TransactionByHash(ctx, txHash)
		if tx != nil || err != ethereum.NotFound {
			return tx, isPending, err
		}
		time.Sleep(interval)
		interval *= 2
	}
	return tx, isPending, errors.New("timeout, " + strconv.FormatInt(time.Since(start).Milliseconds(), 10) + "ms elapsed")
}
func TransactionByHashWithRetry ( ethClient * ethclient . Client , txHash common . Hash , count int ) ( * types . Transaction , bool , error ) { ctx := context . Background ( ) var tx * types . Transaction var isPending bool var err error interval := 1 * time . Millisecond start := time . Now ( ) for i := 0 ; i < count ; i ++ { tx , isPending , err = ethClient . TransactionByHash ( ctx , txHash ) if tx != nil || err != ethereum . NotFound { return tx , isPending , err } time . Sleep ( interval ) interval *= 2 } return tx , isPending , errors . New ( " " + strconv . FormatInt ( time . Since ( start ) . Milliseconds ( ) , 10 ) + " " ) }
Call ethClient.TransactionByHash() repeatedly until the transaction is returned.
Call ethClient . TransactionByHash () repeatedly until the transaction is returned .