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

Method GroupSize

onchain/eth_get.go:136–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134}
135
136func (e *ethAdaptor) GroupSize() (result uint64, err error) {
137 if !e.isConnecting() {
138 err = errors.New("not connecting to geth")
139 }
140 proxies := e.proxies
141 f := func(ctx context.Context) (chan interface{}, chan error) {
142 outc := make(chan interface{})
143 errc := make(chan error)
144 go func() {
145 defer close(outc)
146 defer close(errc)
147 idx := getIndex(ctx)
148 if idx == -1 {
149 err = errors.New("no client index in context")
150 } else {
151 if val, err := proxies[idx].GroupSize(); err != nil {
152 replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx})
153 } else {
154 utils.ReportResult(ctx, outc, val)
155 }
156 }
157 }()
158 return outc, errc
159 }
160 var r interface{}
161 if r, err = e.get(f); err != nil {
162 return
163 }
164 if v, ok := r.(*big.Int); ok {
165 result = v.Uint64()
166 } else {
167 err = errors.New("casting error")
168 }
169 return
170}
171func (e *ethAdaptor) GetWorkingGroupSize() (result uint64, err error) {
172 if !e.isConnecting() {
173 err = errors.New("not connecting to geth")

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
GroupSizeMethod · 0.65

Tested by

no test coverage detected