func (p *http) ReportEvidence(ctx context.Context, ev types.Evidence) error {
	_, err := p.client.BroadcastEvidence(ctx, ev)
	return err
}
ReportEvidence calls `/broadcast_evidence` endpoint.
package http
import (
	"context"
	"errors"
	"fmt"
	"math/rand"
	"net/url"
	"strings"
	"time"
	"github.com/tendermint/tendermint/light/provider"
	rpcclient "github.com/tendermint/tendermint/rpc/client"
	rpchttp "github.com/tendermint/tendermint/rpc/client/http"
	"github.com/tendermint/tendermint/rpc/coretypes"
	rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
	"github.com/tendermint/tendermint/types"
)
var defaultOptions = Options{
	MaxRetryAttempts:    5,
	Timeout:             5 * time.Second,
	NoBlockThreshold:    5,
	NoResponseThreshold: 5,
}
type http struct {
	chainID string
	client  rpcclient.RemoteClient
	noResponseThreshold uint16
	noResponseCount     uint16
	noBlockThreshold uint16
	noBlockCount     uint16
	maxRetryAttempts uint16
}
type Options struct {
	MaxRetryAttempts uint16
	Timeout time.Duration
	NoBlockThreshold uint16
	NoResponseThreshold uint16
}
func New(chainID, remote string) (provider.Provider, error) {
	return NewWithOptions(chainID, remote, defaultOptions)
}
func NewWithOptions(chainID, remote string, options Options) (provider.Provider, error) {
	if !strings.Contains(remote, "://") {
		remote = "http://" + remote
	}
	httpClient, err := rpchttp.NewWithTimeout(remote, options.Timeout)
	if err != nil {
		return nil, err
	}
	return NewWithClientAndOptions(chainID, httpClient, options), nil
}
func NewWithClient(chainID string, client rpcclient.RemoteClient) provider.Provider {
	return NewWithClientAndOptions(chainID, client, defaultOptions)
}
func NewWithClientAndOptions(chainID string, client rpcclient.RemoteClient, options Options) provider.Provider {
	return &http{
		client:              client,
		chainID:             chainID,
		maxRetryAttempts:    options.MaxRetryAttempts,
		noResponseThreshold: options.NoResponseThreshold,
		noBlockThreshold:    options.NoBlockThreshold,
	}
}
func (p *http) String() string {
	return fmt.Sprintf("http{%s}", p.client.Remote())
}
func (p *http) LightBlock(ctx context.Context, height int64) (*types.LightBlock, error) {
	h, err := validateHeight(height)
	if err != nil {
		return nil, provider.ErrBadLightBlock{Reason: err}
	}
	sh, err := p.signedHeader(ctx, h)
	if err != nil {
		return nil, err
	}
	if height != 0 && sh.Height != height {
		return nil, provider.ErrBadLightBlock{
			Reason: fmt.Errorf("height %d responded doesn't match height %d requested", sh.Height, height),
		}
	}
	if sh.Header == nil {
		return nil, provider.ErrBadLightBlock{
			Reason: errors.New("returned header is nil unexpectedly"),
		}
	}
	vs, err := p.validatorSet(ctx, &sh.Height)
	if err != nil {
		return nil, err
	}
	lb := &types.LightBlock{
		SignedHeader: sh,
		ValidatorSet: vs,
	}
	err = lb.ValidateBasic(p.chainID)
	if err != nil {
		return nil, provider.ErrBadLightBlock{Reason: err}
	}
	return lb, nil
}