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

Method LastUpdatedBlock

onchain/eth_get.go:243–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241}
242
243func (e *ethAdaptor) LastUpdatedBlock() (result uint64, err error) {
244 if !e.isConnecting() {
245 err = errors.New("not connecting to geth")
246 }
247 proxies := e.proxies
248 f := func(ctx context.Context) (chan interface{}, chan error) {
249 outc := make(chan interface{})
250 errc := make(chan error)
251 go func() {
252 defer close(outc)
253 defer close(errc)
254 idx := getIndex(ctx)
255 if idx == -1 {
256 err = errors.New("no client index in context")
257 } else {
258 if val, err := proxies[idx].LastUpdatedBlock(); err != nil {
259 replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx})
260 } else {
261 utils.ReportResult(ctx, outc, val)
262 }
263 }
264 }()
265 return outc, errc
266 }
267 var r interface{}
268 if r, err = e.get(f); err != nil {
269 return
270 }
271 if v, ok := r.(*big.Int); ok {
272 result = v.Uint64()
273 } else {
274 err = errors.New("casting error")
275 }
276 return
277}
278func (e *ethAdaptor) NumPendingGroups() (result uint64, err error) {
279 if !e.isConnecting() {
280 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
LastUpdatedBlockMethod · 0.65

Tested by

no test coverage detected