Merge pull request #3010 from wpaulino/node-ann-flake
lntest/itest: prevent direct connection within testNodeAnnouncement
This commit is contained in:
commit
06206f09b5
@ -9334,6 +9334,17 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
t.Fatalf("unable to connect bob to carol: %v", err)
|
t.Fatalf("unable to connect bob to carol: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alice shouldn't receive any new updates yet since the channel has yet
|
||||||
|
// to be opened.
|
||||||
|
select {
|
||||||
|
case <-aliceSub.updateChan:
|
||||||
|
t.Fatalf("received unexpected update from dave")
|
||||||
|
case <-time.After(time.Second):
|
||||||
|
}
|
||||||
|
|
||||||
|
// We'll then go ahead and open a channel between Bob and Dave. This
|
||||||
|
// ensures that Alice receives the node announcement from Bob as part of
|
||||||
|
// the announcement broadcast.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
||||||
chanPoint := openChannelAndAssert(
|
chanPoint := openChannelAndAssert(
|
||||||
ctxt, t, net, net.Bob, dave,
|
ctxt, t, net, net.Bob, dave,
|
||||||
@ -9342,13 +9353,6 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// When Alice now connects with Dave, Alice will get his node
|
|
||||||
// announcement.
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
if err := net.ConnectNodes(ctxt, net.Alice, dave); err != nil {
|
|
||||||
t.Fatalf("unable to connect bob to carol: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
assertAddrs := func(addrsFound []string, targetAddrs ...string) {
|
assertAddrs := func(addrsFound []string, targetAddrs ...string) {
|
||||||
addrs := make(map[string]struct{}, len(addrsFound))
|
addrs := make(map[string]struct{}, len(addrsFound))
|
||||||
for _, addr := range addrsFound {
|
for _, addr := range addrsFound {
|
||||||
@ -9386,6 +9390,9 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We'll then wait for Alice to receive Dave's node announcement
|
||||||
|
// including the expected advertised addresses from Bob since they
|
||||||
|
// should already be connected.
|
||||||
waitForAddrsInUpdate(
|
waitForAddrsInUpdate(
|
||||||
aliceSub, dave.PubKeyStr, advertisedAddrs...,
|
aliceSub, dave.PubKeyStr, advertisedAddrs...,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user