Merge pull request #1230 from wpaulino/wait-for-chan-updates-flake

test: fix update channel policy flake
This commit is contained in:
Olaoluwa Osuntokun 2018-05-11 13:32:13 -07:00 committed by GitHub
commit 28b12116e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -793,20 +793,17 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
for {
select {
case graphUpdate := <-graphUpdates:
if len(graphUpdate.ChannelUpdates) == 0 {
continue
}
chanUpdate := graphUpdate.ChannelUpdates[0]
fundingTxStr := txStr(chanUpdate.ChanPoint)
for _, update := range graphUpdate.ChannelUpdates {
fundingTxStr := txStr(update.ChanPoint)
if _, ok := cps[fundingTxStr]; !ok {
continue
}
if chanUpdate.AdvertisingNode != advertisingNode {
if update.AdvertisingNode != advertisingNode {
continue
}
policy := chanUpdate.RoutingPolicy
policy := update.RoutingPolicy
if policy.FeeBaseMsat != baseFee {
continue
}
@ -827,6 +824,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
if len(cps) == 0 {
break Loop
}
}
case <-time.After(20 * time.Second):
t.Fatalf("did not receive channel update")
}
@ -967,9 +965,15 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
// Wait for all nodes to have seen the policy updates for both of
// Alice's channels.
waitForChannelUpdate(aliceUpdates, net.Alice.PubKeyStr, chanPoint3)
waitForChannelUpdate(bobUpdates, net.Alice.PubKeyStr, chanPoint3)
waitForChannelUpdate(carolUpdates, net.Alice.PubKeyStr, chanPoint3)
waitForChannelUpdate(
aliceUpdates, net.Alice.PubKeyStr, chanPoint, chanPoint3,
)
waitForChannelUpdate(
bobUpdates, net.Alice.PubKeyStr, chanPoint, chanPoint3,
)
waitForChannelUpdate(
carolUpdates, net.Alice.PubKeyStr, chanPoint, chanPoint3,
)
// And finally check that all nodes remembers the policy update they
// received.