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

Method handleReq

onchain/eth_set.go:35–75  ·  view source on GitHub ↗

* Err: transaction failed Err: insufficient funds for gas * price + value ->Fail request and send back error to requester to handle the error Err: failed to retrieve account nonce Err: use of closed network connection ->Switch to other geth to set again */

(req *request)

Source from the content-addressed store, hash-verified

33->Switch to other geth to set again
34*/
35func (e *ethAdaptor) handleReq(req *request) {
36 var tx *types.Transaction
37 var err error
38 var idx int
39 var ctx context.Context
40L:
41 for idx, ctx = range e.ctxes {
42 select {
43 case <-req.opCtx.Done():
44 return
45 case <-ctx.Done():
46 continue
47 default:
48 tx, err = req.f(ctx)
49 if err != nil {
50 if strings.Contains(err.Error(), "transaction failed") ||
51 strings.Contains(err.Error(), "insufficient funds for gas * price + value") {
52 break L
53 }
54 if strings.Contains(err.Error(), "failed to retrieve account nonce") ||
55 strings.Contains(err.Error(), "use of closed network connection") {
56 var oError *OnchainError
57 if errors.As(err, &oError) {
58 e.cancels[oError.Idx]()
59 }
60 }
61 continue
62 }
63 break L
64 }
65 }
66
67 resp := &response{idx, tx, err}
68 go func() {
69 defer close(req.reply)
70 select {
71 case req.reply <- resp:
72 case <-req.opCtx.Done():
73 }
74 }()
75}
76
77func (e *ethAdaptor) waitForReply(req *request) (err error) {
78 for {

Callers 1

ReqLoopMethod · 0.95

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected