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

Method IsPendingNode

onchain/eth_get.go:488–528  ·  view source on GitHub ↗
(id []byte)

Source from the content-addressed store, hash-verified

486 return
487}
488func (e *ethAdaptor) IsPendingNode(id []byte) (result bool, err error) {
489 if !e.isConnecting() {
490 err = errors.New("not connecting to geth")
491 }
492 proxies := e.proxies
493 addr := common.Address{}
494 addr.SetBytes(id)
495 f := func(ctx context.Context) (chan interface{}, chan error) {
496 outc := make(chan interface{})
497 errc := make(chan error)
498 go func() {
499 defer close(outc)
500 defer close(errc)
501 idx := getIndex(ctx)
502 if idx == -1 {
503 err = errors.New("no client index in context")
504 } else {
505 if val, err := proxies[idx].PendingNodeList(addr); err != nil {
506 replyError(ctx, errc, &OnchainError{err: errors.Errorf("get err : %w", err), Idx: idx})
507 } else {
508 utils.ReportResult(ctx, outc, val)
509 }
510 }
511 }()
512 return outc, errc
513 }
514 var r interface{}
515 if r, err = e.get(f); err != nil {
516 return
517 }
518 if v, ok := r.(common.Address); ok {
519 if v.Big().Cmp(big.NewInt(0)) == 0 {
520 result = false
521 } else {
522 result = true
523 }
524 } else {
525 err = errors.New("casting error")
526 }
527 return
528}
529func (e *ethAdaptor) BootstrapRound() (result uint64, err error) {
530 if !e.isConnecting() {
531 err = errors.New("not connecting to geth")

Callers

nothing calls this directly

Calls 8

isConnectingMethod · 0.95
getMethod · 0.95
getIndexFunction · 0.85
replyErrorFunction · 0.85
CmpMethod · 0.80
NewMethod · 0.65
SetBytesMethod · 0.45
PendingNodeListMethod · 0.45

Tested by

no test coverage detected