| 30 | var ErrSubscriberClosed = errors.New("subscriber closed") |
| 31 | |
| 32 | type PollingClient struct { |
| 33 | *ethclient.Client |
| 34 | isHTTP bool |
| 35 | lg log.Logger |
| 36 | pollRate time.Duration |
| 37 | ctx context.Context |
| 38 | cancel context.CancelFunc |
| 39 | currHead *types.Header |
| 40 | esContract common.Address |
| 41 | subID int |
| 42 | NetworkID *big.Int |
| 43 | queryHeader func() (*types.Header, error) |
| 44 | |
| 45 | // pollReqCh is used to request new polls of the upstream |
| 46 | // RPC client. |
| 47 | pollReqCh chan struct{} |
| 48 | |
| 49 | mtx sync.RWMutex |
| 50 | |
| 51 | subs map[int]chan *types.Header |
| 52 | |
| 53 | closedCh chan struct{} |
| 54 | } |
| 55 | |
| 56 | // Dial connects a client to the given URL. |
| 57 | func Dial(rawurl string, esContract common.Address, pollRate uint64, lg log.Logger) (*PollingClient, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected