You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PeerInfo is not persisted if the channel is inbound #133
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.
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.
Activity
tnull commentedon Jun 30, 2023
Ah, good point. Yes, we're currently only automatically reconnecting outbound channels, we should probably do the same for inbound.
jbesraa commentedon Oct 3, 2023
Happy to pick this up
tnull commentedon Oct 3, 2023
Sure, go for it!
tnull commentedon Nov 16, 2023
@MaxFangX Looking into this more closely this description seems erroneous, in particular step 1):
PeerManager::get_peer_node_ids()will return a currently-connectedSocketAddress, 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.