Skip to content

PeerInfo is not persisted if the channel is inbound #133

Closed

Description

@MaxFangX

Our node is loosely based off of ldk-node and ldk-sample, and we discovered that if a third party node initiates a channel open to us, and if they don't regularly attempt to reconnect to us (like the LDK examples do), we'll end up with a channel which is is_channel_ready but which is not is_usable. We observed this when we connected to the LND faucet, restarted our node, and ended up with a ready but unusable channel.

I believe this is a bug, or is at least not the intended design, and so wanted to report it back here.

Fixing this was straightforward for us - we set manually_accept_inbound_channels: true and changed the handler for Event::OpenChannelRequest to (1) look up the channel initiator's p2p address using PeerManager::get_peer_node_ids(), (2) persist the PeerInfo, (3) update our p2p reconnector task, and (4) finally accept the channel.

Activity

  1. tnull commented on Jun 30, 2023

    @tnull
    Collaborator

    Ah, good point. Yes, we're currently only automatically reconnecting outbound channels, we should probably do the same for inbound.

  2. added this to the 0.2 milestone on Sep 27, 2023
  3. jbesraa commented on Oct 3, 2023

    @jbesraa
    Contributor

    Happy to pick this up

  4. tnull commented on Oct 3, 2023

    @tnull
    Collaborator

    Sure, go for it!

  5. tnull commented on Nov 16, 2023

    @tnull
    Collaborator

    Fixing this was straightforward for us - we set manually_accept_inbound_channels: true and changed the handler for Event::OpenChannelRequest to (1) look up the channel initiator's p2p address using PeerManager::get_peer_node_ids(), (2) persist the PeerInfo, (3) update our p2p reconnector task, and (4) finally accept the channel.

    @MaxFangX Looking into this more closely this description seems erroneous, in particular step 1): PeerManager::get_peer_node_ids() will return a currently-connected SocketAddress, however, for inbound connections this very likely would contain the port number of the counterparty's outbound socket, not its listening address. So in order to do this properly you'll have to look up the listening address in the public network graph, and forgo persisting the inbound connection if your counterparty isn't announced. Just also mentioning this here as you might want to double-check your implementation logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions