mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-11 05:29:11 +02:00
lntest: show reconnection bug
In this commit we demonstrate a bug to show that if an inbound peer changes their listening address to one not advertised in their original NodeAnnouncement then we will not be able to reconnect to them. This bug will be fixed in a follow-up commit.
This commit is contained in:
parent
d639a4d73f
commit
6b5b53d517
@ -197,6 +197,34 @@ func testReconnectAfterIPChange(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// assert that Dave and Charlie reconnect successfully after Dave
|
||||
// changes to his second advertised address.
|
||||
assertConnected(t, dave, charlie)
|
||||
|
||||
// Next we test the case where Dave changes his listening address to one
|
||||
// that was not listed in his original advertised addresses. The desired
|
||||
// behaviour is that Charlie will update his connection requests to Dave
|
||||
// when he receives the Node Announcement from Dave with his updated
|
||||
// address.
|
||||
|
||||
// Change Dave's listening port and restart.
|
||||
dave.Cfg.P2PPort = lntest.NextAvailablePort()
|
||||
dave.Cfg.ExtraArgs = []string{
|
||||
fmt.Sprintf(
|
||||
"--externalip=127.0.0.1:%d", dave.Cfg.P2PPort,
|
||||
),
|
||||
}
|
||||
err = net.RestartNode(dave, nil)
|
||||
require.NoError(t.t, err)
|
||||
|
||||
// Show that Charlie does receive Dave's new listening address in
|
||||
// a Node Announcement.
|
||||
waitForNodeAnnouncement(
|
||||
charlieSub, dave.PubKeyStr,
|
||||
[]string{fmt.Sprintf("127.0.0.1:%d", dave.Cfg.P2PPort)},
|
||||
)
|
||||
|
||||
// assert that Dave and Charlie do not reconnect after Dave changes
|
||||
// his P2P address to one not listed in Dave's original advertised list
|
||||
// of addresses. This is a bug that will be fixed in a follow-up commit.
|
||||
assertNotConnected(t, dave, charlie)
|
||||
}
|
||||
|
||||
// assertTimeoutError asserts that a connection timeout error is raised. A
|
||||
|
Loading…
x
Reference in New Issue
Block a user