LN-Juggernaut / juggernaut-desktop

Decentralized messaging and payments
https://www.getjuggernaut.com
MIT License
130 stars 14 forks source link

Sent Messages From Other Machines Missing #49

Open johncantrell97 opened 4 years ago

johncantrell97 commented 4 years ago

If you run Juggernaut on more than one machine you will be missing sent messages on the devices you did not send them from.

On wallet launch we only fetch sentMessages on the FIRST launch of the wallet. The reason was that I assumed you would only ever have one client and therefore when you send a message we would always capture it.

The simplest fix is to just import all sent messages on every launch of the wallet. There are unique constraints on the database so there won't be duplicate messages but it's potentially a lot of processing each launch. There's currently no way to filter for messages after some date / settle_index / some other id and we'd be forced to fetch all messages.

In LND 0.10 they introduced "fake" paging for listPayments. We could use this on 0.10 and stop fetching the next page anytime we reach a message we already have. This reminds me we also need to figure out a good solution for handling features that are only available in certain versions of LND while still supporting multiple versions.

The other way to fix this would be to add a 'sync / refresh' messages button that a user can click that will initiate the sync. This solution has the benefit of not needing to sync all payments on every launch of the wallet for users who are only using 1 client.

I guess the ultimate solution would be to have a toggle on whether or not they want to sync on every launch (if they use multiple clients often then they would turn this on) and include a manual sync somewhere in settings (that we don'e have).

Thoughts on how we should solve this as at least a temporary solution until we have user settings?