SubscribeEvent is a log subscription operation
(subscribeTypes []int)
| 101 | |
| 102 | // SubscribeEvent is a log subscription operation |
| 103 | func (e *ethAdaptor) SubscribeEvent(subscribeTypes []int) (chan interface{}, chan error) { |
| 104 | var eventList []chan interface{} |
| 105 | var errcs []chan error |
| 106 | for _, subscribeType := range subscribeTypes { |
| 107 | if subscribeType >= SubscribeCommitrevealLogStartCommitreveal { |
| 108 | for i := 0; i < len(e.crs); i++ { |
| 109 | if e.crs[i] == nil || |
| 110 | e.ctxes[i] == nil { |
| 111 | continue |
| 112 | } |
| 113 | select { |
| 114 | case <-e.ctxes[i].Done(): |
| 115 | continue |
| 116 | default: |
| 117 | } |
| 118 | out, errc := crTable[subscribeType](e.ctxes[i], e.crs[i]) |
| 119 | eventList = append(eventList, out) |
| 120 | errcs = append(errcs, errc) |
| 121 | } |
| 122 | } else { |
| 123 | for i := 0; i < len(e.proxies); i++ { |
| 124 | if e.proxies[i] == nil || |
| 125 | e.ctxes[i] == nil { |
| 126 | continue |
| 127 | } |
| 128 | select { |
| 129 | case <-e.ctxes[i].Done(): |
| 130 | continue |
| 131 | default: |
| 132 | } |
| 133 | out, errc := proxyTable[subscribeType](e.ctxes[i], e.proxies[i]) |
| 134 | eventList = append(eventList, out) |
| 135 | errcs = append(errcs, errc) |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | return firstEvent(e.ctx, merge(e.ctx, eventList...)), mergeError(e.ctx, errcs...) |
| 140 | } |
| 141 | |
| 142 | func getIndex(ctx context.Context) (idx int) { |
| 143 | if v := ctx.Value("index"); v != nil { |
nothing calls this directly
no test coverage detected