GroupToPick returns the groupToPick value
()
| 61 | |
| 62 | // GroupToPick returns the groupToPick value |
| 63 | func (e *ethAdaptor) GroupToPick() (result uint64, err error) { |
| 64 | if !e.isConnecting() { |
| 65 | err = errors.New("not connecting to geth") |
| 66 | } |
| 67 | proxies := e.proxies |
| 68 | f := func(ctx context.Context) (chan interface{}, chan error) { |
| 69 | outc := make(chan interface{}) |
| 70 | errc := make(chan error) |
| 71 | go func() { |
| 72 | defer close(outc) |
| 73 | defer close(errc) |
| 74 | idx := getIndex(ctx) |
| 75 | if idx == -1 { |
| 76 | err = errors.New("no client index in context") |
| 77 | } else { |
| 78 | if val, err := proxies[idx].GroupToPick(); err != nil { |
| 79 | replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx}) |
| 80 | } else { |
| 81 | utils.ReportResult(ctx, outc, val) |
| 82 | } |
| 83 | } |
| 84 | }() |
| 85 | return outc, errc |
| 86 | } |
| 87 | var r interface{} |
| 88 | if r, err = e.get(f); err != nil { |
| 89 | return |
| 90 | } |
| 91 | if v, ok := r.(*big.Int); ok { |
| 92 | result = v.Uint64() |
| 93 | } else { |
| 94 | err = errors.New("casting error") |
| 95 | } |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | // GetExpiredWorkingGroupSize returns the GetExpiredWorkingGroupSize value |
| 100 | func (e *ethAdaptor) GetExpiredWorkingGroupSize() (result uint64, err error) { |
nothing calls this directly
no test coverage detected