Skip to content

Commit 577c91d

Browse files
committed
zombierecovery: fix query
1 parent 49f67ed commit 577c91d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cmd/chantools/zombierecovery_findmatches.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
"(?m)(?s)ID: ([0-9a-f]{66})\nContact: (.*?)\nTime: ",
2323
)
2424

25-
ambossQueryDelay = 7 * time.Second
25+
ambossQueryDelay = 4 * time.Second
2626

2727
initialTemplate = `SEND TO: {{.Contact}}
2828
@@ -134,8 +134,7 @@ This command will be run by guggero and the result will be sent to the
134134
registered nodes.`,
135135
Example: `chantools zombierecovery findmatches \
136136
--registrations data.txt \
137-
--channel_graph lncli_describegraph.json \
138-
--pairs_done pairs-done.json`,
137+
--ambosskey <API key>`,
139138
RunE: cc.Execute,
140139
}
141140

@@ -332,10 +331,12 @@ func (c *zombieRecoveryFindMatchesCommand) Execute(_ *cobra.Command,
332331
func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel,
333332
error) {
334333

334+
offset := 0.0
335+
limit := 50.0
335336
variables := map[string]interface{}{
336337
"pubkey": pubkey,
337338
"limit": 50.0,
338-
"offset": 0.0,
339+
"offset": offset,
339340
}
340341

341342
var channels []*gqChannel
@@ -346,16 +347,15 @@ func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel,
346347
return nil, err
347348
}
348349

349-
if len(query.GetNode.GraphInfo.Channels.ChannelList.List) == 0 {
350+
channelList := query.GetNode.GraphInfo.Channels.ChannelList
351+
channels = append(channels, channelList.List...)
352+
353+
if len(channelList.List) < int(limit) {
350354
break
351355
}
352356

353-
channels = append(
354-
channels,
355-
query.GetNode.GraphInfo.Channels.ChannelList.List...,
356-
)
357-
358-
variables["offset"] = variables["offset"].(float64) + 50.0
357+
offset += 50.0
358+
variables["offset"] = offset
359359
}
360360

361361
return channels, nil

0 commit comments

Comments
 (0)