Skip to content

Switch to use NetAddress for peer addresses - #85

Closed
tnull wants to merge 3 commits into
lightningdevkit:mainfrom
tnull:2023-05-switch-to-netaddress
Closed

Switch to use NetAddress for peer addresses#85
tnull wants to merge 3 commits into
lightningdevkit:mainfrom
tnull:2023-05-switch-to-netaddress

Conversation

@tnull

@tnulltnull commented May 3, 2023

Copy link
Copy Markdown
Collaborator

Fixes#11, based on #84.

We so far waited for lightningdevkit/rust-lightning#2056 to be resolved. However, as it didn't happen in time for LDK 0.0.115, we now switch our peer info to use a newtype around NetAddress so that we won't have to break serialization compatibility when the upstream changes become available post-0.1.

@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch from ba818f2 to 29a7c9aCompareMay 3, 2023 12:46
@tnulltnull mentioned this pull request May 3, 2023
47 tasks
@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch 2 times, most recently from 04032ec to 38c5707CompareMay 9, 2023 07:59
@tnull

tnull commented May 9, 2023

Copy link
Copy Markdown
CollaboratorAuthor

Rebased on #84 after #25 had been merged. Added NetAddress bindings support.

@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch from 38c5707 to 3042d2bCompareMay 10, 2023 07:32
@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Rebased on main after #84 landed.

@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Rebased after #56 has been merged.

@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Rebased on main.

@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch from abfda94 to 8f9229cCompareMay 19, 2023 12:10

@wpaulinowpaulino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI your commits are unsigned.

Comment threadsrc/types.rs Outdated
Comment threadsrc/types.rs Outdated
Comment threadsrc/types.rs Outdated
Comment threadsrc/types.rs Outdated
Comment threadsrc/types.rs Outdated
Comment threadsrc/types.rs Outdated
Comment threadsrc/lib.rs
@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch from 8f9229c to a87508cCompareMay 21, 2023 06:26
@tnull

Copy link
Copy Markdown
CollaboratorAuthor

FYI your commits are unsigned.

Thanks, they are actually all signed, just to a different user ID. Not exactly sure why Github is showing as unverified, it knows both email addresses... Will need to look into that.

@wpaulinowpaulino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feel free to squash.

Comment threadsrc/lib.rs Outdated
@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch 3 times, most recently from 9780c83 to 67f4811CompareMay 23, 2023 07:58
@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Squashed commits and included the following changes:

diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl
index d31865a..b767de0 100644
--- a/bindings/ldk_node.udl+++ b/bindings/ldk_node.udl@@ -74,5 +74,4 @@ enum NodeError {
"InvoiceCreationFailed",
"PaymentFailed",
- "PeerInfoNotFound",
"ChannelCreationFailed",
"ChannelClosingFailed",
diff --git a/src/error.rs b/src/error.rs
index 7fdd9d6..1d59fc0 100644
--- a/src/error.rs+++ b/src/error.rs@@ -16,6 +16,4 @@ pub enum Error {
/// An attempted payment has failed.
PaymentFailed,
- /// A given peer info could not be found.- PeerInfoNotFound,
/// A channel could not be opened.
ChannelCreationFailed,
@@ -71,5 +69,4 @@ impl fmt::Display for Error {
Self::InvoiceCreationFailed => write!(f, "Failed to create invoice."),
Self::PaymentFailed => write!(f, "Failed to send the given payment."),
- Self::PeerInfoNotFound => write!(f, "Failed to resolve the given peer information."),
Self::ChannelCreationFailed => write!(f, "Failed to create channel."),
Self::ChannelClosingFailed => write!(f, "Failed to close channel."),
diff --git a/src/lib.rs b/src/lib.rs
index 0b8e7eb..75e74cf 100644
--- a/src/lib.rs+++ b/src/lib.rs@@ -1608,5 +1608,8 @@ async fn do_connect_peer(
let socket_addr = addr
.to_socket_addrs()
- .map_err(|_| Error::PeerInfoNotFound)?+ .map_err(|e| {+ log_error!(logger, "Failed to resolve network address: {}", e);+ Error::InvalidNetAddress+ })?
.next()
.ok_or(Error::ConnectionFailed)?;

tnull added 3 commits May 23, 2023 13:29
While we're still blocked on upstream changes, we now switch our peer info
to use a newtype around `NetAddress` so that we won't have to break
serialization compatibility when the upstream changes becom available
post-0.1.
@tnull
tnullforce-pushed the 2023-05-switch-to-netaddress branch from 67f4811 to 63f3105CompareMay 23, 2023 11:29
Comment threadsrc/lib.rs Outdated
@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Closing manually as the merge somehow didn't close this.

Sign up for freeto 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

@tnull@wpaulino