Merge pull request #1230 from wpaulino/wait-for-chan-updates-flake
test: fix update channel policy flake
This commit is contained in:
commit
28b12116e4
68
lnd_test.go
68
lnd_test.go
@ -793,39 +793,37 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case graphUpdate := <-graphUpdates:
|
case graphUpdate := <-graphUpdates:
|
||||||
if len(graphUpdate.ChannelUpdates) == 0 {
|
for _, update := range graphUpdate.ChannelUpdates {
|
||||||
continue
|
fundingTxStr := txStr(update.ChanPoint)
|
||||||
}
|
if _, ok := cps[fundingTxStr]; !ok {
|
||||||
chanUpdate := graphUpdate.ChannelUpdates[0]
|
continue
|
||||||
fundingTxStr := txStr(chanUpdate.ChanPoint)
|
}
|
||||||
if _, ok := cps[fundingTxStr]; !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if chanUpdate.AdvertisingNode != advertisingNode {
|
if update.AdvertisingNode != advertisingNode {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
policy := chanUpdate.RoutingPolicy
|
policy := update.RoutingPolicy
|
||||||
if policy.FeeBaseMsat != baseFee {
|
if policy.FeeBaseMsat != baseFee {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if policy.FeeRateMilliMsat != feeRate*feeBase {
|
if policy.FeeRateMilliMsat != feeRate*feeBase {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if policy.TimeLockDelta != timeLockDelta {
|
if policy.TimeLockDelta != timeLockDelta {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// We got a policy update that matched the
|
// We got a policy update that matched the
|
||||||
// values and channel point of what we
|
// values and channel point of what we
|
||||||
// expected, delete it from the map.
|
// expected, delete it from the map.
|
||||||
delete(cps, fundingTxStr)
|
delete(cps, fundingTxStr)
|
||||||
|
|
||||||
// If we have no more channel points we are
|
// If we have no more channel points we are
|
||||||
// waiting for, break out of the loop.
|
// waiting for, break out of the loop.
|
||||||
if len(cps) == 0 {
|
if len(cps) == 0 {
|
||||||
break Loop
|
break Loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case <-time.After(20 * time.Second):
|
case <-time.After(20 * time.Second):
|
||||||
t.Fatalf("did not receive channel update")
|
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
|
// Wait for all nodes to have seen the policy updates for both of
|
||||||
// Alice's channels.
|
// Alice's channels.
|
||||||
waitForChannelUpdate(aliceUpdates, net.Alice.PubKeyStr, chanPoint3)
|
waitForChannelUpdate(
|
||||||
waitForChannelUpdate(bobUpdates, net.Alice.PubKeyStr, chanPoint3)
|
aliceUpdates, net.Alice.PubKeyStr, chanPoint, chanPoint3,
|
||||||
waitForChannelUpdate(carolUpdates, net.Alice.PubKeyStr, 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
|
// And finally check that all nodes remembers the policy update they
|
||||||
// received.
|
// received.
|
||||||
|
Loading…
Reference in New Issue
Block a user