From 2700c97d2b349981ad1d3e6af9f63123715c02a9 Mon Sep 17 00:00:00 2001 From: Anton Kovalenko Date: Thu, 17 Nov 2022 00:21:54 +0300 Subject: [PATCH] cmd/lncli/walletrpc_active.go: avoid nested getContext [skip ci] Pass down a context from bumpCloseFee to getWaitingCloseCommitments, to avoid another call to getContext that used to fail with "intercept already active" --- cmd/lncli/walletrpc_active.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/lncli/walletrpc_active.go b/cmd/lncli/walletrpc_active.go index 5f3d082bf..34802f1a7 100644 --- a/cmd/lncli/walletrpc_active.go +++ b/cmd/lncli/walletrpc_active.go @@ -5,6 +5,7 @@ package main import ( "bytes" + "context" "encoding/base64" "encoding/hex" "encoding/json" @@ -320,7 +321,9 @@ func bumpCloseFee(ctx *cli.Context) error { defer cleanUp() // Fetch waiting close channel commitments. - commitments, err := getWaitingCloseCommitments(client, channelPoint) + commitments, err := getWaitingCloseCommitments( + ctxc, client, channelPoint, + ) if err != nil { return err } @@ -379,11 +382,9 @@ func bumpCloseFee(ctx *cli.Context) error { return nil } -func getWaitingCloseCommitments(client lnrpc.LightningClient, - channelPoint string) (*lnrpc.PendingChannelsResponse_Commitments, - error) { - - ctxc := getContext() +func getWaitingCloseCommitments(ctxc context.Context, + client lnrpc.LightningClient, channelPoint string) ( + *lnrpc.PendingChannelsResponse_Commitments, error) { req := &lnrpc.PendingChannelsRequest{} resp, err := client.PendingChannels(ctxc, req)