mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-06 13:09:52 +02: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,
|
net *lntest.NetworkHarness, node *lntest.HarnessNode,
|
||||||
fundingChanPoint *lnrpc.ChannelPoint,
|
fundingChanPoint *lnrpc.ChannelPoint,
|
||||||
anchors, force bool) *chainhash.Hash {
|
anchors, force bool) *chainhash.Hash {
|
||||||
|
|
||||||
|
ctxt, cancel := context.WithTimeout(ctxb, channelCloseTimeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
// Fetch the current channel policy. If the channel is currently
|
// Fetch the current channel policy. If the channel is currently
|
||||||
// enabled, we will register for graph notifications before closing to
|
// enabled, we will register for graph notifications before closing to
|
||||||
// assert that the node sends out a disabling update as a result of the
|
// 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.
|
// updates before initiating the channel closure.
|
||||||
var graphSub *graphSubscription
|
var graphSub *graphSubscription
|
||||||
if expectDisable {
|
if expectDisable {
|
||||||
sub := subscribeGraphNotifications(ctx, t, node)
|
sub := subscribeGraphNotifications(ctxt, t, node)
|
||||||
graphSub = &sub
|
graphSub = &sub
|
||||||
defer close(graphSub.quit)
|
defer close(graphSub.quit)
|
||||||
}
|
}
|
||||||
|
|
||||||
closeUpdates, _, err := net.CloseChannel(
|
closeUpdates, _, err := net.CloseChannel(
|
||||||
ctx, node, fundingChanPoint, force,
|
ctxt, node, fundingChanPoint, force,
|
||||||
)
|
)
|
||||||
require.NoError(t.t, err, "unable to close channel")
|
require.NoError(t.t, err, "unable to close channel")
|
||||||
|
|
||||||
@ -244,7 +247,7 @@ func closeChannelAndAssertType(ctx context.Context, t *harnessTest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return assertChannelClosed(
|
return assertChannelClosed(
|
||||||
ctx, t, net, node, fundingChanPoint, anchors, closeUpdates,
|
ctxt, t, net, node, fundingChanPoint, anchors, closeUpdates,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user