Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection not possible when switching from LNC node to another node and back #1783

Closed
myxmaster opened this issue Oct 19, 2023 · 2 comments · Fixed by #2615
Closed

connection not possible when switching from LNC node to another node and back #1783

myxmaster opened this issue Oct 19, 2023 · 2 comments · Fixed by #2615
Labels
Bug Something isn't working Lightning Node Connect

Comments

@myxmaster
Copy link
Contributor

myxmaster commented Oct 19, 2023

Describe the bug

(Might be related to #1483, but not sure.)

When you are connected to a node via LNC, then switch to another node and then back to the LNC node again, Zeus cannot
connect and displays "Failed to connect the LNC client to the proxy server". Using the "Restart" button or killing the app fixes the
problem and Zeus will connect to the LNC node again.

The connect method in LNC class runs through fine (no error):

/**
* Connects to the LNC proxy server
* @returns a promise that resolves when the connection is established
*/
async connect() {
// do not attempt to connect multiple times
const connected = await this.isConnected();
if (connected) return;
NativeModules.LncModule.registerLocalPrivCreateCallback(
this._namespace,
this.onLocalPrivCreate
);
NativeModules.LncModule.registerRemoteKeyReceiveCallback(
this._namespace,
this.onRemoteKeyReceive
);
NativeModules.LncModule.registerAuthDataCallback(
this._namespace,
this.onAuthData
);
const { pairingPhrase, localKey, remoteKey, serverHost } =
this.credentials;
// connect to the server
const error = await NativeModules.LncModule.connectServer(
this._namespace,
serverHost,
false,
pairingPhrase,
localKey,
remoteKey
);
return error;
}

What happens, when the error occurs, is: BackendUtils.isConnected() keeps returning false until Zeus gives up:

zeus/stores/SettingsStore.ts

Lines 1212 to 1225 in e0125a6

counter++;
const connected = await BackendUtils.isConnected();
if (connected) {
clearInterval(interval);
this.loading = false;
resolve();
} else if (counter > 20) {
clearInterval(interval);
this.error = true;
this.errorMsg = localeString(
'stores.SettingsStore.lncConnectError'
);
this.loading = false;
resolve(this.errorMsg);

I made sure BackendUtils.isConnected() is really calling isConnected() in LNC class, so question is: why is it not possible to establish a connection when switching nodes like this?

Edit:
I can reproduce this issue with Zeus v0.8.0 on my physical device (Galaxy Tab S9+, Android 13) and emulator (Android Emulator Pixel 7 Pro, Android 14).
I can not reproduce it with Zeus v0.7.7 on my physical device (Samsung Galaxy S20+, Android 13).

Reproduce

Zeus version

v0.8.0

Node interface

LND (Lightning Node Connect)

Network

Clearnet

Device

Android Emulator Pixel 7 Pro

Device operating system

Android 14

Log output

No response

@myxmaster myxmaster added the Bug Something isn't working label Oct 19, 2023
@BitcoinMechanic
Copy link

BitcoinMechanic commented Mar 25, 2024

I have a similar issue just around LNC connected Zeus just timing out. I have to restart the app every single time I use it. It always connects reliably upon restart though.

edit: running grapheneOS, zeus v0.8.2, friend has exact same issue on iPhone with whatever version is on the app store.

@kaloudis
Copy link
Contributor

Maybe the disconnect call isn't getting executed properly, or perhaps we have a system issue. Would be nice to get some more clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Lightning Node Connect
Projects
None yet
3 participants