itest: manage context inside WaitForChannelOpen and WaitForChannelClose
This commit is contained in:
7 files changed
+22
-22
No files matched your search
+10
-2
@@ -1123,9 +1123,13 @@ func (n *NetworkHarness) OpenPendingChannel(ctx context.Context,
|
||||
// consuming a message from the past open channel stream. If the passed context
|
||||
// has a timeout, then if the timeout is reached before the channel has been
|
||||
// opened, then an error is returned.
|
||||
func (n *NetworkHarness) WaitForChannelOpen(ctx context.Context,
|
||||
func (n *NetworkHarness) WaitForChannelOpen(
|
||||
openChanStream lnrpc.Lightning_OpenChannelClient) (*lnrpc.ChannelPoint, error) {
|
||||
|
||||
ctxb := context.Background()
|
||||
ctx, cancel := context.WithTimeout(ctxb, ChannelOpenTimeout)
|
||||
defer cancel()
|
||||
|
||||
errChan := make(chan error)
|
||||
respChan := make(chan *lnrpc.ChannelPoint)
|
||||
go func() {
|
||||
@@ -1294,9 +1298,13 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context,
|
||||
// stream that the node has deemed the channel has been fully closed. If the
|
||||
// passed context has a timeout, then if the timeout is reached before the
|
||||
// notification is received then an error is returned.
|
||||
func (n *NetworkHarness) WaitForChannelClose(ctx context.Context,
|
||||
func (n *NetworkHarness) WaitForChannelClose(
|
||||
closeChanStream lnrpc.Lightning_CloseChannelClient) (*chainhash.Hash, error) {
|
||||
|
||||
ctxb := context.Background()
|
||||
ctx, cancel := context.WithTimeout(ctxb, ChannelCloseTimeout)
|
||||
defer cancel()
|
||||
|
||||
errChan := make(chan error)
|
||||
updateChan := make(chan *lnrpc.CloseStatusUpdate_ChanClose)
|
||||
go func() {
|
||||
|
||||
Reference in new issue
Block a user