lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Add identifiers to channel resolutions

Open joshfix opened this issue 3 years ago • 2 comments

For accounting purposes, it is desirable to build tools to facilitate automatically extracting and recording all channel resolutions data from closed channels. It is unclear whether or not resolutions data is subject to mutation over time (to include adding outpoints, sweep txids, or adding new resolutions). Given this unknown, we have written code that collects all the resolutions data from a closedchannels RPC response, then compares the resolutions with previously recorded values for each channel. Because the resolutions have no unique identifier, it becomes quite tricky to determine which resolutions should be compared for equality to determine if a mutation has occurred.

Currently our organization has implemented a solution to compare resolution slice length per channel, sort the slice of resolutions, and use a custom equality operation to determine if any of the values have changed. If so, instead of attempting to determine and identify each individual resolution that was changed and update it accordingly, we wipe all the resolutions for the channel from our db and rewrite them with the new data. The process is a bit expensive in our systems, especially in terms of db queries.

It would be very beneficial to either 1) understand whether or not resolutions are not subject to mutation or if they are completely final once they appear in the data set or 2) to provide identifiers on each resolution so they can be easily selected and checked for mutations.

joshfix avatar Oct 05 '22 13:10 joshfix

Do the faraday accounting tools give you the functionality you need: https://github.com/lightninglabs/faraday/blob/master/docs/accounting.md?

Roasbeef avatar Oct 05 '22 18:10 Roasbeef

We have a fairly complex/custom system to record our data and our own accounting tools that interact with the databases we record the data to. We are interested in checking out the capabilities of Faraday, however this is still an issue (inefficiency) for us and we would still benefit from some sort of unique identifier on the resolutions.

joshfix avatar Feb 16 '24 18:02 joshfix