Hi Dan,

> I'm trying to understand what the correct behaviour is when two nodes
> (Alice and Bob) have an open channel, and one of the channels (Alice)
> loses their IPv4 lease,

> 1. Is there a specific behaviour prescribed in any spec in this scenario?

Assuming one of the nodes has a public listening interface and a static IP,
then they _should_ be able to connect to each other again after a period of
time has passed.

The relevant message here is the `node_announcement` message which is sent
on the gossip layer. If one of the nodes detects that its IP has changed,
then it can send out a new `node_announcement` message on the network (and
also potentially directly to the peer it was/is connected to).

The `channel_reestablish` is sent _after_ a new encrypted Brontide
connection has been established between the two nodes. With the way the
handshake works, you need to know the public key of the remote party to
initiate the connection, and after the handshake, both sides know the static
public key in play. They can then use this to look up the channel state that
corresponds with that public key (might be many channels, which is where the
`channel_id` field comes in).

> 2. Is this behaviour left purely up to the particular LN implementation?

In order to make sure that your channel peers can connect to you again, if
your IP changes, then a node SHOULD re-send a new `node_announcement`.

There's also a recent-ish extension to the spec that enables nodes to just
put a domain name directly in the node announcement:
https://github.com/lightning/bolts/pull/911. However, this hasn't yet been
implemented fully in lnd, the tracking issue can be found here:
https://github.com/lightningnetwork/lnd/issues/6337.

> 3. How would the LND implementation handle this exactly?

`lnd` has a `--nat` CLI/config arg that'll use NAT-PMP in the background to
attempt to traverse NAT on a best effort basis.

Alternatively, `lnd` supports specifying a set of host names (DNS domains)
that should be watched for IP addr changes [1]. If the IP addr resolved by
any of the hosts changes, then `lnd` will automatically send out a new
`node_announcement` message with the updated set of IPs.

-- Laolu

[1]:
https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf#L77-L84

On Wed, Feb 21, 2024 at 1:09 AM Dan Bryant <dkbry...@gmail.com> wrote:

> I'm trying to understand what the correct behaviour is when two nodes
> (Alice and Bob) have an open channel, and one of the channels (Alice)
> loses their IPv4 lease, but attempts to reestablish communication to
> their peer (Bob)?  Would Alice_node send out a `channel_reestablish`
> message to Bob_node, and if so, would Bob_node reject it due the the
> origin IP, or would Bob_node reestablish communication using the new
> Alice_node IPv4 address?
>
> I realize these problems are moot in IPv6 and Tor connections, but I'm
> asking specifically about IPv4
>
> 1. Is there a specific behaviour prescribed in any spec in this scenario?
> 2. Is this behaviour left purely up to the particular LN implementation?
> 3. How would the LND implementation handle this exactly?
>
>
> https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev
>
_______________________________________________
Lightning-dev mailing list
Lightning-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev

Reply via email to