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

Update NodeAnnouncement address advertisement to match spec #131

Closed
3 tasks done
Roasbeef opened this issue Feb 12, 2017 · 2 comments
Closed
3 tasks done

Update NodeAnnouncement address advertisement to match spec #131

Roasbeef opened this issue Feb 12, 2017 · 2 comments
Labels
beginner Issues suitable for new developers database Related to the database/storage of LND p2p Code related to the peer-to-peer behaviour routing wire protocol Encoding of messages for the communication between nodes
Milestone

Comments

@Roasbeef
Copy link
Member

Roasbeef commented Feb 12, 2017

Currently, the lnwire.NodeAnnouncement uses a recently dated format for communicating the reachable address of a particular node. Atm we assume that they're always encoding an IPv4 or IPv6 address within an IPv6 address. However, this is rather restricts as it means we can't signal hidden service addresses (both the current and next-gen version), or i2p address etc. A recent modification to the spec allows for a much more flexible format, which can be adapted to any new address types we'd like to advertise in the future.

Additionally, the database (channeldb.LightnignNode) should be updated to also store a variable number of address for a particular ndoe.

Steps To Completion

  • Modify the Address field within the lnwire.NodeAnnouncement struct to instead be a more flexible []net.Addr

  • Modify the encoding/decoding routine for lnwire.NodeAnnouncement to use the format defined within the specification. Rather than packing in a single IPv6 address, it should now pack in an integer signaling the number of addresses, then induvidual pack in each known address with a byte prefix denoting the proper type.

  • Modify the encoding/decoding routines for channeldb.LightningNode to also accept and update a variable amount of reachable addresses.

Follow Up Tasks

Once the above has been completed, then the logic around the connmgr should also be updated to attempt to connect out to all advertised addresses. In the event that we're able to connect out or revive a connection from one of the advertise addresses, then all the gorourtines launched by the connmgr to connect out to the directed node should be cancelled. This will require a modification to the connmgr package within btcd to allow the cancellation of a connection attempt that didn't succeed. Currently one is only able to cancel a persistent connection attempt iff one was successful in the past.

@Roasbeef Roasbeef added beginner Issues suitable for new developers database Related to the database/storage of LND p2p Code related to the peer-to-peer behaviour routing wire protocol Encoding of messages for the communication between nodes labels Feb 12, 2017
@Roasbeef Roasbeef added this to the v0.2-alpha milestone Feb 12, 2017
@bryanvu
Copy link
Contributor

bryanvu commented Feb 15, 2017

Will take this one.

bryanvu added a commit to bryanvu/lnd that referenced this issue Mar 1, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue lightningnetwork#131 .
bryanvu added a commit to bryanvu/lnd that referenced this issue Mar 3, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue lightningnetwork#131 .
bryanvu added a commit to bryanvu/lnd that referenced this issue Mar 20, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue lightningnetwork#131 .
bryanvu added a commit to bryanvu/lnd that referenced this issue Mar 22, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue lightningnetwork#131 .
bryanvu added a commit to bryanvu/lnd that referenced this issue Mar 29, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue lightningnetwork#131 .
Roasbeef pushed a commit that referenced this issue Mar 29, 2017
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue #131 .
@Roasbeef
Copy link
Member Author

Closed by #154.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner Issues suitable for new developers database Related to the database/storage of LND p2p Code related to the peer-to-peer behaviour routing wire protocol Encoding of messages for the communication between nodes
Projects
None yet
Development

No branches or pull requests

2 participants