circular icon indicating copy to clipboard operation
circular copied to clipboard

No channel found for short channel id

Open swissrouting opened this issue 2 years ago • 2 comments

I freshly installed circular on a RaspiBlitz instance today and get an error on first launch.

Steps to reproduce

$ cd /home/bitcoin/cl-plugins-available
$ wget https://github.com/giovannizotta/circular/releases/download/0.1/circular-0.1-linux-arm64.tar.gz
$ tar -xvf ./circular-0.1-linux-arm64.tar.gz
$ chmod +x ./circular
$ lightning-cli plugin start /home/bitcoin/cl-plugins-available/circular
{
   "code": -3,
   "message": "/home/bitcoin/cl-plugins-available/circular: exited before replying to init"
}

Logs from CLN

2022-08-14T16:00:07.224Z INFO    plugin-circular: node.go:70 Init: initializing node
2022-08-14T16:00:08.152Z UNUSUAL plugin-circular: node.go:82 Init: no graph to load
2022-08-14T15:56:34.133Z UNUSUAL plugin-circular: cron.go:49 refreshGraph: error listing channels: No channel found for short channel id
2022-08-14T15:56:34.137Z UNUSUAL plugin-circular:
2022-08-14T15:56:34.148Z INFO    plugin-circular: Killing plugin: exited before replying to init

The specific channel ID is not shown, so I'm unable to gather more info about whether there is a specific channel at fault.

swissrouting avatar Aug 14 '22 16:08 swissrouting

This is because the listchannels RPC takes too long to return. On my Raspberry Pi 4:

$ time lightning-cli listchannels > /dev/null
real    1m40.279s

CLN only allows a plugin 60 seconds to start up before it's automatically killed. So my node is simply too slow to do a channel list in this time.

A hacky workaround to get this running (with an old version of the graph):

$ git clone https://github.com/giovannizotta/circular.git
$ cd circular
$ cp graph/testdata/mainnet_graph.json /home/bitcoin/.lightning/circular/graph.json
$ vi node/cron.go        <------- comment out the line "n.refreshGraph()"
$ go build -o circular cmd/circular/*.go
$ chmod +x circular
$ lightning-cli plugin start /home/bitcoin/cl-plugins-available/circular/circular

This is not suitable for production because the graph is never updated. But it demonstrates that the plugin itself works fine other than the slow listchannels RPC method on my node.

swissrouting avatar Aug 14 '22 20:08 swissrouting

Thank you @swissrouting for the cooperation during the troubleshooting and for reporting. This brought us to 3db06f62aba309056d2fe4ae0f8fa177d9e3180f which brings our RPC timeout to 60s, but we can't stretch above that for the reason you've pointed out.

On a laptop, listchannels takes 3-5 seconds to run, which is acceptable for our usecase. On a raspberry, this call can take several minutes and this is not acceptable.

The reason why we have to poll listchannels is because we need up-to-date gossip information: by default we do this on startup and every 10 minutes. A cleaner solution would be to have gossip notifications from CLN so we wouldn't have to call listchannels constantly, but there's no such notification in CLN.

One would need to build a plugin that reads from gossmap and sends notifications to all the subscribers, but this is not planned for circular.

giovannizotta avatar Aug 14 '22 21:08 giovannizotta