peer: ensure a peer can exit mid cooperative closure

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-08-21 23:54:53 -07:00
parent c09713ebd1
commit 3086a9d06a
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -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