Skip to content

Commit

Permalink
peer: ensure a peer can exit mid cooperative closure
Browse files Browse the repository at this point in the history
This commit adds another conditional send select statement to ensure
that when sending the finalized contract to the breach arbiter, the
peer doesn’t possible cause the daemon to hang on shutdown.
  • Loading branch information
Roasbeef committed Aug 22, 2017
1 parent c09713e commit 3086a9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,11 @@ func (p *peer) handleClosingSigned(localReq *htlcswitch.ChanClose,
// Once we've completed the cooperative channel closure, we'll wipe the
// channel so we reject any incoming forward or payment requests via
// this channel.
select {
case p.server.breachArbiter.settledContracts <- chanPoint:
case <-p.server.quit:
return nil, 0
}
if err := p.WipeChannel(channel); err != nil {
if localReq != nil {
localReq.Err <- err
Expand Down

0 comments on commit 3086a9d

Please sign in to comment.