Skip to content

Commit e620288

Browse files
committed
tapchannel: use new context for call to unlockLeases
If the funding attempt takes a while and/or the users cancels the original request, if we're using the context passed along, then we may fail to actually unlock all the inputs: ``` 2024-08-03 13:13:54.004 [ERR] TCHN: unable to unlock inputs: unable to unlock outpoint X:2: error listing existing leases: rpc error: code = Canceled desc = context canceled 2024-08-03 13:13:54.004 [DBG] TCHN: unlocking asset inputs: ([]wire.OutPoint) (len=1 cap=1) { (wire.OutPoint) X:1 } 2024-08-03 13:13:54.004 [ERR] TCHN: Unable to unlock asset inputs: unable to unlock asset outpoints [X:1]: unable to release coins: context canceled ``` This commit fixes that by using a fresh context.
1 parent cf34c65 commit e620288

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tapchannel/aux_funding_controller.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,14 +1395,13 @@ func (f *FundingController) processFundingReq(fundingFlows fundingFlowIndex,
13951395
// We'll use this closure to ensure that we'll always unlock the inputs
13961396
// if we encounter an error below.
13971397
unlockLeases := func() {
1398-
err := fundingState.unlockInputs(fundReq.ctx, f.cfg.ChainWallet)
1398+
ctxb := context.Background()
1399+
err := fundingState.unlockInputs(ctxb, f.cfg.ChainWallet)
13991400
if err != nil {
14001401
log.Errorf("unable to unlock inputs: %v", err)
14011402
}
14021403

1403-
err = fundingState.unlockAssetInputs(
1404-
fundReq.ctx, f.cfg.CoinSelector,
1405-
)
1404+
err = fundingState.unlockAssetInputs(ctxb, f.cfg.CoinSelector)
14061405
if err != nil {
14071406
log.Errorf("Unable to unlock asset inputs: %v", err)
14081407
}

0 commit comments

Comments
 (0)