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

Function mergeError

onchain/eth_helpers.go:85–113  ·  view source on GitHub ↗
(ctx context.Context, cs ...chan error)

Source from the content-addressed store, hash-verified

83}
84
85func mergeError(ctx context.Context, cs ...chan error) chan error {
86 var wg sync.WaitGroup
87 out := make(chan error)
88
89 // Start an output goroutine for each input channel in cs. output
90 // copies values from c to out until c is closed, then calls wg.Done.
91 output := func(c <-chan error) {
92 for n := range c {
93 select {
94 case <-ctx.Done():
95 return
96 case out <- n:
97 }
98 }
99 wg.Done()
100 }
101 wg.Add(len(cs))
102 for _, c := range cs {
103 go output(c)
104 }
105
106 // Start a goroutine to close out once all the output goroutines are
107 // done. This must start after the wg.Add call.
108 go func() {
109 wg.Wait()
110 close(out)
111 }()
112 return out
113}
114
115func GenEthkey(credentialPath, passPhrase string) (err error) {
116 debug.FreeOSMemory()

Callers 2

SubscribeEventMethod · 0.85
getMethod · 0.85

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected