Skip to content

Commit 60b907a

Browse files
committed
loopin: refactor htlc conf event loop
1 parent 98faa8c commit 60b907a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

loopin.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,19 @@ func (s *loopInSwap) waitForHtlcConf(globalCtx context.Context) (
406406
return nil, err
407407
}
408408

409-
for {
409+
var conf *chainntnfs.TxConfirmation
410+
for conf == nil {
410411
select {
411412

412413
// P2WSH htlc confirmed.
413-
case conf := <-confChanP2WSH:
414+
case conf = <-confChanP2WSH:
414415
s.htlc = s.htlcP2WSH
415416
s.log.Infof("P2WSH htlc confirmed")
416-
return conf, nil
417417

418418
// NP2WSH htlc confirmed.
419-
case conf := <-confChanNP2WSH:
419+
case conf = <-confChanNP2WSH:
420420
s.htlc = s.htlcNP2WSH
421421
s.log.Infof("NP2WSH htlc confirmed")
422-
return conf, nil
423422

424423
// Conf ntfn error.
425424
case err := <-confErrP2WSH:
@@ -438,6 +437,8 @@ func (s *loopInSwap) waitForHtlcConf(globalCtx context.Context) (
438437
return nil, globalCtx.Err()
439438
}
440439
}
440+
441+
return conf, nil
441442
}
442443

443444
// publishOnChainHtlc checks whether there are still enough blocks left and if

0 commit comments

Comments
 (0)