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

Option to auto connect to onion-supporting peers #98

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

orbitalturtle
Copy link
Collaborator

This PR implements part of #88, by introducing a config option users can turn on to automatically connect to random onion-supporting peers using the network graph.

Also squeezed in a couple of typo fixes.

I think a good followup would be to try to reconnect to other onion-supporting peers once the number of onion-supporting peers falls below a certain threshold. So something like, once we receive a disconnect event, we check how many remaining onion-supporting peers there are and connect accordingly.

@@ -299,6 +302,65 @@ async fn lookup_onion_support(pubkey: &PublicKey, client: &mut tonic_lnd::Lightn
}
}

/// connect_to_onion_peers picks a few random nodes from the network graph that support onion messenging, then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messenging -> messaging or messages ?

Ok(())
}

/// get_onion_peers picks a few onion-messenging-supporting nodes from the network graph.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messenging -> messaging or messages ?

for peer in onion_peers.iter() {
connector
.connect_peer(peer.0.clone(), peer.1.clone())
.await?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the connect peer API return an error if LND fails to connect to a peer?
In my testing, LNDK doesn't print error logs on connection failure.

@dunxen dunxen self-requested a review August 31, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants