Skip to content

Commit

Permalink
contractcourt/chain_watcher: release mutex on return
Browse files Browse the repository at this point in the history
  • Loading branch information
cfromknecht committed Apr 11, 2018
1 parent bc029b9 commit 218293d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contractcourt/chain_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDet
select {
case sub.CooperativeClosure <- struct{}{}:
case <-c.quit:
c.Unlock()
return fmt.Errorf("exiting")
}
}
Expand Down Expand Up @@ -536,6 +537,7 @@ func (c *chainWatcher) dispatchRemoteClose(commitSpend *chainntnfs.SpendDetail,
select {
case sub.UnilateralClosure <- uniClose:
case <-c.quit:
c.Unlock()
return fmt.Errorf("exiting")
}
}
Expand Down Expand Up @@ -600,6 +602,7 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
select {
case sub.ContractBreach <- retribution:
case <-c.quit:
c.Unlock()
return fmt.Errorf("quitting")
}

Expand All @@ -611,11 +614,13 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
case err := <-sub.ProcessACK:
// Bail if the handoff failed.
if err != nil {
c.Unlock()
return fmt.Errorf("unable to handoff "+
"retribution info: %v", err)
}

case <-c.quit:
c.Unlock()
return fmt.Errorf("quitting")
}
}
Expand Down

0 comments on commit 218293d

Please sign in to comment.