lightninglabs / chantools

A loose collection of tools all somehow related to lnd and Lightning Network channels.
MIT License
222 stars 32 forks source link

Chantools for postgres #53

Open hazrulnizam opened 1 year ago

hazrulnizam commented 1 year ago

This is not an issue, but I cannot find a discussion tab for this project so I will ask my question here.

I am interested to perform a chantools dropchannelgraph but for a postgres-backed lnd. Is there any way to do this? I tried browsing through the postgres db especially the channeldb_kv to see if I can understand the contents but it is just a key-value table with binary (not human readable) data in the key and value columns.

If you can share maybe a SQL delete statement that I can run to get a similar effect to chantools dropchannelgraph it would be appreciated. Thanks.

guggero commented 1 year ago

There is no easy way to do this yet. Dropping the channel graph does mean removing certain top-level KV buckets (which could be done with an SQL query). But to get the node working again, the node's own channels need to be re-inserted into the graph afterwards, otherwise things won't work properly. And that can only be done with the custom business logic implemented in chantools. So I'll need to add the ability for chantools to connect to a remote Postgres DB to perform the operation. But I don't think I'll have time to do that any time soon...

SeverinAlexB commented 5 months ago

+1 for general postgres support