From 3086a9d06a8970a40baf8787d7c8ac0e3c319867 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 21 Aug 2017 23:54:53 -0700 Subject: [PATCH] peer: ensure a peer can exit mid cooperative closure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- peer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/peer.go b/peer.go index 4ac9ddca9..bdeaa3fcc 100644 --- a/peer.go +++ b/peer.go @@ -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