mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
itest: create context with timeout in closeChannelAndAssertType
This commit is contained in:
parent
be341bcd68
commit
2e4417454b
@ -203,11 +203,14 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
)
|
||||
}
|
||||
|
||||
func closeChannelAndAssertType(ctx context.Context, t *harnessTest,
|
||||
func closeChannelAndAssertType(ctxb context.Context, t *harnessTest,
|
||||
net *lntest.NetworkHarness, node *lntest.HarnessNode,
|
||||
fundingChanPoint *lnrpc.ChannelPoint,
|
||||
anchors, force bool) *chainhash.Hash {
|
||||
|
||||
ctxt, cancel := context.WithTimeout(ctxb, channelCloseTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Fetch the current channel policy. If the channel is currently
|
||||
// enabled, we will register for graph notifications before closing to
|
||||
// assert that the node sends out a disabling update as a result of the
|
||||
@ -221,13 +224,13 @@ func closeChannelAndAssertType(ctx context.Context, t *harnessTest,
|
||||
// updates before initiating the channel closure.
|
||||
var graphSub *graphSubscription
|
||||
if expectDisable {
|
||||
sub := subscribeGraphNotifications(ctx, t, node)
|
||||
sub := subscribeGraphNotifications(ctxt, t, node)
|
||||
graphSub = &sub
|
||||
defer close(graphSub.quit)
|
||||
}
|
||||
|
||||
closeUpdates, _, err := net.CloseChannel(
|
||||
ctx, node, fundingChanPoint, force,
|
||||
ctxt, node, fundingChanPoint, force,
|
||||
)
|
||||
require.NoError(t.t, err, "unable to close channel")
|
||||
|
||||
@ -244,7 +247,7 @@ func closeChannelAndAssertType(ctx context.Context, t *harnessTest,
|
||||
}
|
||||
|
||||
return assertChannelClosed(
|
||||
ctx, t, net, node, fundingChanPoint, anchors, closeUpdates,
|
||||
ctxt, t, net, node, fundingChanPoint, anchors, closeUpdates,
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user