lntest: wait until channel is active within AssertChannelExists

In this commit, we fix a race condition where at times we open a channel
between two parties and immediately try to send payments over it. At
times this would fail due to the channel link not being fully registered
in the HTLC switch.
This commit is contained in:
Wilmer Paulino 2018-05-23 01:45:55 -04:00
parent 42de4400bf
commit d543ff5811
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -998,8 +998,8 @@ func (n *NetworkHarness) WaitForChannelClose(ctx context.Context,
} }
} }
// AssertChannelExists asserts that an active channel identified by // AssertChannelExists asserts that an active channel identified by the
// channelPoint is known to exist from the point-of-view of node.. // specified channel point exists from the point-of-view of the node.
func (n *NetworkHarness) AssertChannelExists(ctx context.Context, func (n *NetworkHarness) AssertChannelExists(ctx context.Context,
node *HarnessNode, chanPoint *wire.OutPoint) error { node *HarnessNode, chanPoint *wire.OutPoint) error {
@ -1015,7 +1015,7 @@ func (n *NetworkHarness) AssertChannelExists(ctx context.Context,
for _, channel := range resp.Channels { for _, channel := range resp.Channels {
if channel.ChannelPoint == chanPoint.String() { if channel.ChannelPoint == chanPoint.String() {
return true return channel.Active
} }
} }