rpc: wrap canceling a breach watch in a select case
This commit is contained in:
parent
c183e8984c
commit
d39410cc01
@ -613,7 +613,11 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
||||
r.server.htlcSwitch.RemoveLink(chanID)
|
||||
}
|
||||
|
||||
r.server.breachArbiter.settledContracts <- chanPoint
|
||||
select {
|
||||
case r.server.breachArbiter.settledContracts <- chanPoint:
|
||||
case <-r.quit:
|
||||
return fmt.Errorf("server shutting down")
|
||||
}
|
||||
|
||||
// With the necessary indexes cleaned up, we'll now force close
|
||||
// the channel.
|
||||
|
@ -165,6 +165,7 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
||||
s.htlcSwitch = htlcswitch.New(htlcswitch.Config{
|
||||
LocalChannelClose: func(pubKey []byte,
|
||||
request *htlcswitch.ChanClose) {
|
||||
|
||||
s.peersMtx.RLock()
|
||||
peer, ok := s.peersByPub[string(pubKey)]
|
||||
s.peersMtx.RUnlock()
|
||||
|
Loading…
Reference in New Issue
Block a user