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

BOLT 1: add networks to init message. #682

Merged
merged 2 commits into from
Feb 18, 2020

Conversation

rustyrussell
Copy link
Collaborator

This has been discussed for forever, but now we have TLVs
the correct encoding seems obvious.

Signed-off-by: Rusty Russell [email protected]

Copy link
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

ACK, does this supercede #678 or does it only complement it?

@rustyrussell
Copy link
Collaborator Author

I think it replaces it, TBH. I'm not sure that query_channels means you should hang up.

Copy link
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

Sounds good then, I do think it supercedes it but wanted confirmation.

@Roasbeef
Copy link
Collaborator

Roasbeef commented Oct 4, 2019

We have no real support for cross-chain routing in the protocol as is today, as a result, what use is this?

@rustyrussell
Copy link
Collaborator Author

We have no real support for cross-chain routing in the protocol as is today, as a result, what use is this?

It means you can hang up if you accidentally connect to a testnet node?

@@ -225,8 +225,16 @@ Both fields `globalfeatures` and `localfeatures` MUST be padded to bytes with 0s
* [`gflen*byte`:`globalfeatures`]
* [`u16`:`lflen`]
* [`lflen*byte`:`localfeatures`]
* [`init_tlvs`:`tlvs`]
Copy link
Collaborator

Choose a reason for hiding this comment

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

qq on how we define this (i'm not super familiar with the parsing code): intuitively i would think that this would be

  * [`tlvs`: `init_tlvs`]

where tlvs is the type, and init_tlvs is the name. the current way is flipped from what I would expect, maybe i'm just not thinking about it correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The type is actually defined below... Confusing I know, but it's a consequence of incrementally implementing parsing.

We could just imply TLV from now on, with msg foo having a foo_tlv implicitly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

either works for me, was just curious what the guidelines are :)

@@ -243,6 +252,8 @@ The receiving node:
- MUST ignore the bit.
- upon receiving unknown _even_ feature bits that are non-zero:
- MUST fail the connection.
- upon receiving `networks` containing no common chains
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the prescribed action if some chains intersect but not all? would think receivers should restrict all messages they send to this intersection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, like @Roasbeef I haven't thought too hard about multi-chain implementation.

Hmm, I think that addition (SHOULD) would be positive, yes.

@Roasbeef Roasbeef added the Meeting Discussion Raise at next meeting label Oct 28, 2019
@Sword-Smith
Copy link
Contributor

As a person who has accidently connected to several main net nodes with his test net node, I strongly support this pull request. With the added hope that the various implementations hang up if the network is wrong.

@rustyrussell
Copy link
Collaborator Author

OK, added the "don't forward gossip they're not interested in" sentence.

@rustyrussell rustyrussell added the Awaiting Interop Approved, pending 2 or more impl interoperating label Nov 25, 2019
darosior added a commit to darosior/lightning that referenced this pull request Nov 28, 2019
darosior added a commit to darosior/lightning that referenced this pull request Nov 28, 2019
darosior added a commit to darosior/lightning that referenced this pull request Nov 28, 2019
This implements lightning/bolts#682.

Changelog-Added: protocol: We now signal the network we are running on at init.
@rustyrussell
Copy link
Collaborator Author

FWIW, this was accidentally merged into the latest c-lightning master (ElementsProject/lightning#3300). Seems to have caused no issues on my test nodes, but explicit interop is probably desirable (i.e. someone else implement and check it works with ours):

Mainnet: 024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605@128.199.202.16

Testnet:
031a3478d481b92e3c28810228252898c5f0d82fc4d07f5210c4f34d4aba56b769@165.227.30.200

And yeah, I tested that they refuse to maintain connections to each other now :)

This has been discussed for forever, but now we have TLVs
the correct encoding seems obvious.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell
Copy link
Collaborator Author

Trivial rebase, and whitespace cleanup.

@t-bast
Copy link
Collaborator

t-bast commented Dec 13, 2019

Seems to have caused no issues on my test nodes

I just tested that it doesn't cause any issue with existing eclair nodes; they simply ignore the TLV stream as expected.

I'll implement this and will let you know if compatibility is ok. Simply looking at the encoded TLV stream that c-lightning sends, it looks ok to me.

@cdecker
Copy link
Collaborator

cdecker commented Dec 13, 2019

Thanks @t-bast for checking. That puts my mind at ease

@t-bast
Copy link
Collaborator

t-bast commented Dec 16, 2019

I've implemented this on Eclair and tested compatibility with c-lightning, and there's a small issue.
Here are the test cases I ran:

  • Eclair advertising NetworkA and c-lightning advertising NetworkA -> nodes stay connected -> OK
  • Eclair advertising NetworkA and c-lightning advertising NetworkB -> nodes disconnect -> OK
  • Eclair advertising [NetworkA, NetworkB] and c-lightning advertising NetworkB -> c-lightning disconnects -> NOK

This isn't an issue for Eclair/c-lightning compatibility since we support a single chain, but it may be an issue with lnd if they advertize Bitcoin+Litecoin: c-lightning would reject connections from such lnd nodes.

@rustyrussell @cdecker I think this is worth fixing quickly on c-lightning master branch.

@darosior
Copy link
Contributor

@t-bast I think ElementsProject/lightning#3371 fixes that.

@t-bast
Copy link
Collaborator

t-bast commented Feb 4, 2020

This has been implemented by c-lightning and eclair.
I believe @cfromknecht ACK-ed in a previous IRC meeting, is that right?
In my opinion this just needs a rebase and can be merged.

Copy link
Collaborator

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM ⛷

@t-bast t-bast merged commit 7b01692 into lightning:master Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Interop Approved, pending 2 or more impl interoperating Meeting Discussion Raise at next meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants