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

Method GroupToPick

onchain/eth_get.go:63–97  ·  view source on GitHub ↗

GroupToPick returns the groupToPick value

()

Source from the content-addressed store, hash-verified

61
62// GroupToPick returns the groupToPick value
63func (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
100func (e *ethAdaptor) GetExpiredWorkingGroupSize() (result uint64, err error) {

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

Tested by

no test coverage detected