From 8ad14d0a2cb55d3969e585f1a4d65107606ce29e Mon Sep 17 00:00:00 2001 From: Oli Date: Wed, 22 Oct 2025 12:53:00 +0200 Subject: [PATCH] zombierecovery: catch another server error for re-try Re-try the server query for another possible error message. --- cmd/chantools/zombierecovery_findmatches.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cmd/chantools/zombierecovery_findmatches.go b/cmd/chantools/zombierecovery_findmatches.go index 03f0ee6..1228340 100644 --- a/cmd/chantools/zombierecovery_findmatches.go +++ b/cmd/chantools/zombierecovery_findmatches.go @@ -379,7 +379,7 @@ func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel, var query gqGetNodeQuery err := client.Query(context.Background(), &query, variables) if err != nil { - if strings.Contains(err.Error(), "Too many requests") { + if isServerErr(err) { time.Sleep(1 * time.Second) continue } @@ -401,6 +401,24 @@ func fetchChannels(client *graphql.Client, pubkey string) ([]*gqChannel, return channels, nil } +func isServerErr(err error) bool { + if err == nil { + return false + } + + errStr := err.Error() + switch { + case strings.Contains(errStr, "Too many requests"): + return true + + case strings.Contains(errStr, "error code: 520"): + return true + + default: + return false + } +} + func identifyPeer(channel *gqChannel, node1 string) string { if channel.Node1 == node1 { return channel.Node2