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

Method GetExpiredWorkingGroupSize

onchain/eth_get.go:100–134  ·  view source on GitHub ↗

GetExpiredWorkingGroupSize returns the GetExpiredWorkingGroupSize value

()

Source from the content-addressed store, hash-verified

98
99// GetExpiredWorkingGroupSize returns the GetExpiredWorkingGroupSize value
100func (e *ethAdaptor) GetExpiredWorkingGroupSize() (result uint64, err error) {
101 if !e.isConnecting() {
102 err = errors.New("not connecting to geth")
103 }
104 proxies := e.proxies
105 f := func(ctx context.Context) (chan interface{}, chan error) {
106 outc := make(chan interface{})
107 errc := make(chan error)
108 go func() {
109 defer close(outc)
110 defer close(errc)
111 idx := getIndex(ctx)
112 if idx == -1 {
113 err = errors.New("no client index in context")
114 } else {
115 if val, err := proxies[idx].GetExpiredWorkingGroupSize(); err != nil {
116 replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx})
117 } else {
118 utils.ReportResult(ctx, outc, val)
119 }
120 }
121 }()
122 return outc, errc
123 }
124 var r interface{}
125 if r, err = e.get(f); err != nil {
126 return
127 }
128 if v, ok := r.(*big.Int); ok {
129 result = v.Uint64()
130 } else {
131 err = errors.New("casting error")
132 }
133 return
134}
135
136func (e *ethAdaptor) GroupSize() (result uint64, err error) {
137 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

Tested by

no test coverage detected