mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopin: refactor htlc conf event loop
This commit is contained in:
parent
98faa8c59d
commit
60b907a34f
1 changed files with 6 additions and 5 deletions
11
loopin.go
11
loopin.go
|
|
@ -406,20 +406,19 @@ func (s *loopInSwap) waitForHtlcConf(globalCtx context.Context) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for {
|
||||
var conf *chainntnfs.TxConfirmation
|
||||
for conf == nil {
|
||||
select {
|
||||
|
||||
// P2WSH htlc confirmed.
|
||||
case conf := <-confChanP2WSH:
|
||||
case conf = <-confChanP2WSH:
|
||||
s.htlc = s.htlcP2WSH
|
||||
s.log.Infof("P2WSH htlc confirmed")
|
||||
return conf, nil
|
||||
|
||||
// NP2WSH htlc confirmed.
|
||||
case conf := <-confChanNP2WSH:
|
||||
case conf = <-confChanNP2WSH:
|
||||
s.htlc = s.htlcNP2WSH
|
||||
s.log.Infof("NP2WSH htlc confirmed")
|
||||
return conf, nil
|
||||
|
||||
// Conf ntfn error.
|
||||
case err := <-confErrP2WSH:
|
||||
|
|
@ -438,6 +437,8 @@ func (s *loopInSwap) waitForHtlcConf(globalCtx context.Context) (
|
|||
return nil, globalCtx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
// publishOnChainHtlc checks whether there are still enough blocks left and if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue