From abdc5a5ff04d41e640c9d1454e8524ada22ac833 Mon Sep 17 00:00:00 2001 From: aftermath2 Date: Mon, 29 Dec 2025 15:28:40 +0000 Subject: [PATCH] Fix channel requests from nodes without public channels --- main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 936235d..cf33465 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,7 @@ import ( "github.com/aftermath2/acceptlnd/lightning" "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnwire" "github.com/pkg/errors" ) @@ -114,7 +115,19 @@ func handleRequest( } peer, err := client.GetNodeInfo(ctx, getPeerInfoReq) if err != nil { - return resp, errors.New("Internal server error") + if req.ChannelFlags == uint32(lnwire.FFAnnounceChannel) { + return resp, errors.New("Internal server error") + } + + slog.Warn("Couldn't get peer node information, likely because it has no public channels. Using request details") + peer = &lnrpc.NodeInfo{ + Node: &lnrpc.LightningNode{ + PubKey: hex.EncodeToString(req.NodePubkey), + }, + TotalCapacity: 0, + Channels: []*lnrpc.ChannelEdge{}, + NumChannels: 0, + } } slog.Debug("Peer node information", slog.Any("node", peer))