-
Notifications
You must be signed in to change notification settings - Fork 102
Unify interface types and expose connect
/ disconnect
methods
#52
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
Merged
tnull
merged 2 commits into
lightningdevkit:main
from
tnull:2023-03-expose-connect-method
Apr 25, 2023
Merged
Unify interface types and expose connect
/ disconnect
methods
#52
tnull
merged 2 commits into
lightningdevkit:main
from
tnull:2023-03-expose-connect-method
Apr 25, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Draft for now as still WIP. |
84780ba
to
44dfca3
Compare
connect_peer
/ disconnect_peer
methodsconnect_peer
/ disconnect_peer
methods
63b9f70
to
13f8c55
Compare
connect_peer
/ disconnect_peer
methodsconnect
/ disconnect
methods
13f8c55
to
e3a6a3a
Compare
e3a6a3a
to
e9f2e53
Compare
Rebased on main after #13 has been merged. |
jkczyz
reviewed
Apr 19, 2023
e9f2e53
to
3faadd7
Compare
Addressed feedback and rebased on main. |
9d1fba8
to
ef1f8ff
Compare
Rebased on main once more. |
ef1f8ff
to
de7fc2a
Compare
jkczyz
reviewed
Apr 25, 2023
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.
LGTM modulo a couple minor comments. Feel free to squash.
So far the interface sometimes took `String`s, `&str`s, or actual Rust types. Moreover we sometimes took the arguments by reference and sometimes not. In order to make the interface more uniform, we here take a step towards the Rust types and taking arguments by reference. Note that some of the affected parts are due to change in the future, e.g., once we transition to using upstream's `NetAddress` for peer addresses.
de7fc2a
to
f07ec07
Compare
Squashed commits and removed a few more clones: diff --git a/src/lib.rs b/src/lib.rs
index 1145aa0..8ce9bd6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -859,6 +859,6 @@ impl Node {
let peer_info = PeerInfo { pubkey: node_id, address };
- let con_peer_pubkey = peer_info.pubkey.clone();
- let con_peer_addr = peer_info.address.clone();
+ let con_peer_pubkey = peer_info.pubkey;
+ let con_peer_addr = peer_info.address;
let con_success = Arc::new(AtomicBool::new(false));
let con_success_cloned = Arc::clone(&con_success);
@@ -879,10 +879,10 @@ impl Node {
}
+ log_info!(self.logger, "Connected to peer {}@{}. ", peer_info.pubkey, peer_info.address,);
+
if permanently {
- self.peer_store.add_peer(peer_info.clone())?;
+ self.peer_store.add_peer(peer_info)?;
}
- log_info!(self.logger, "Connected to peer {}@{}. ", peer_info.pubkey, peer_info.address,);
-
Ok(())
}
@@ -939,6 +939,6 @@ impl Node {
let peer_info = PeerInfo { pubkey: node_id, address };
- let con_peer_pubkey = peer_info.pubkey.clone();
- let con_peer_addr = peer_info.address.clone();
+ let con_peer_pubkey = peer_info.pubkey;
+ let con_peer_addr = peer_info.address;
let con_success = Arc::new(AtomicBool::new(false));
let con_success_cloned = Arc::clone(&con_success);
@@ -983,5 +983,4 @@ impl Node {
) {
Ok(_) => {
- self.peer_store.add_peer(peer_info.clone())?;
log_info!(
self.logger,
@@ -989,4 +988,5 @@ impl Node {
peer_info.pubkey
);
+ self.peer_store.add_peer(peer_info)?;
Ok(())
} |
jkczyz
approved these changes
Apr 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #13.So far the interface sometimes took
String
s,&str
s, or actual Rusttypes. Moreover we sometimes took the arguments by reference and
sometimes not. In order to make the interface more uniform, we here take a step towards
the Rust types and taking arguments by reference.
Note that some of the affected parts are due to change in the future,
e.g., once we transition to using upstream's
NetAddress
for peeraddresses.
Also, by user request, we expose the capability to just connect a peer, which is useful for example when awaiting an incoming channel from an LSP.