MCPcopy Create free account
hub / github.com/DOSNetwork/core / GetWorkingGroupSize

Method GetWorkingGroupSize

onchain/eth_get.go:171–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169 return
170}
171func (e *ethAdaptor) GetWorkingGroupSize() (result uint64, err error) {
172 if !e.isConnecting() {
173 err = errors.New("not connecting to geth")
174 }
175 proxies := e.proxies
176 f := func(ctx context.Context) (chan interface{}, chan error) {
177 outc := make(chan interface{})
178 errc := make(chan error)
179 go func() {
180 defer close(outc)
181 defer close(errc)
182 idx := getIndex(ctx)
183 if idx == -1 {
184 err = errors.New("no client index in context")
185 } else {
186 if val, err := proxies[idx].GetWorkingGroupSize(); err != nil {
187 replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx})
188 } else {
189 utils.ReportResult(ctx, outc, val)
190 }
191 }
192 }()
193 return outc, errc
194 }
195 var r interface{}
196 if r, err = e.get(f); err != nil {
197 return
198 }
199 if v, ok := r.(*big.Int); ok {
200 result = v.Uint64()
201 } else {
202 err = errors.New("casting error")
203 }
204 return
205}
206
207func (e *ethAdaptor) LastGroupFormationRequestId() (result uint64, err error) {
208 if !e.isConnecting() {

Callers

nothing calls this directly

Calls 7

isConnectingMethod · 0.95
getMethod · 0.95
getIndexFunction · 0.85
replyErrorFunction · 0.85
Uint64Method · 0.80
NewMethod · 0.65
GetWorkingGroupSizeMethod · 0.65

Tested by

no test coverage detected