peer+server: add HandleLocalCloseChanReqs to peer, call from server
This commit is contained in:
parent
e1632dd172
commit
bf161c9835
14
peer.go
14
peer.go
@ -2857,6 +2857,20 @@ func (p *peer) handleCloseMsg(msg *closeMsg) {
|
||||
p.finalizeChanClosure(chanCloser)
|
||||
}
|
||||
|
||||
// HandleLocalCloseChanReqs accepts a *htlcswitch.ChanClose and passes it onto
|
||||
// the channelManager goroutine, which will shut down the link and possibly
|
||||
// close the channel.
|
||||
func (p *peer) HandleLocalCloseChanReqs(req *htlcswitch.ChanClose) {
|
||||
select {
|
||||
case p.localCloseChanReqs <- req:
|
||||
peerLog.Infof("Local close channel request delivered to peer: %v",
|
||||
p.PubKey())
|
||||
case <-p.quit:
|
||||
peerLog.Infof("Unable to deliver local close channel request to peer "+
|
||||
"%x", p.PubKey())
|
||||
}
|
||||
}
|
||||
|
||||
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
|
||||
// allowed to update the channel state.
|
||||
type LinkUpdater interface {
|
||||
|
10
server.go
10
server.go
@ -491,15 +491,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, chanDB *channeldb.DB,
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case peer.localCloseChanReqs <- request:
|
||||
srvrLog.Infof("Local close channel request "+
|
||||
"delivered to peer: %x", pubKey[:])
|
||||
case <-peer.quit:
|
||||
srvrLog.Errorf("Unable to deliver local close "+
|
||||
"channel request to peer %x, err: %v",
|
||||
pubKey[:], err)
|
||||
}
|
||||
peer.HandleLocalCloseChanReqs(request)
|
||||
},
|
||||
FwdingLog: chanDB.ForwardingLog(),
|
||||
SwitchPackager: channeldb.NewSwitchPackager(),
|
||||
|
Loading…
Reference in New Issue
Block a user