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

Method dkgTest

dosnode/dos_restapis.go:183–230  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

181 return lines, nil
182}
183func (d *DosNode) dkgTest(w http.ResponseWriter, r *http.Request) {
184 groupID := big.NewInt(0)
185 start := -1
186 end := -1
187 switch r.Method {
188 case "GET":
189 for k, v := range r.URL.Query() {
190 fmt.Printf("[DOS] %s: %s\n", k, v)
191 if k == "start" {
192 i, err := strconv.Atoi(v[0])
193 if err == nil && i >= 0 {
194 start = i
195 }
196 } else if k == "end" {
197 i, err := strconv.Atoi(v[0])
198 if err == nil && i >= 0 {
199 end = i
200 }
201 } else if k == "gid" {
202 i, err := strconv.Atoi(v[0])
203 if err == nil && i >= 0 {
204 groupID = groupID.SetInt64(int64(i))
205 }
206 }
207 }
208 }
209 members, err := readLines("/vault/members.txt")
210 if err != nil {
211 d.logger.Error(err)
212 return
213 }
214 if start >= 0 && end >= 0 {
215 if len(members) < (end - start) {
216 d.logger.Info(fmt.Sprintf("[DOS] members size not enough:%d", len(members)))
217 return
218 }
219 var participants [][]byte
220
221 for i := start; i < end; i++ {
222 participants = append(participants, []byte(members[i]))
223 }
224
225 d.onchainEvent <- &onchain.LogGrouping{
226 GroupId: groupID,
227 NodeId: participants,
228 }
229 }
230}
231func (d *DosNode) queryTest(w http.ResponseWriter, r *http.Request) {
232 groupId := big.NewInt(0)
233 lastSys := big.NewInt(0)

Callers

nothing calls this directly

Calls 5

SetInt64Method · 0.95
readLinesFunction · 0.85
ErrorMethod · 0.65
InfoMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected