-
Notifications
You must be signed in to change notification settings - Fork 22
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
base: master
Are you sure you want to change the base?
Conversation
4500b35
to
0c1c532
Compare
@@ -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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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.
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.