peer+server: add HandleLocalCloseChanReqs to peer, call from server
This commit is contained in:
1 parent
e1632dd172
commit
bf161c9835
2 files changed
+15
-9
No files matched your search
@@ -2857,6 +2857,20 @@ func (p *peer) handleCloseMsg(msg *closeMsg) {
|
|||||||
p.finalizeChanClosure(chanCloser)
|
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
|
// LinkUpdater is an interface implemented by most messages in BOLT 2 that are
|
||||||
// allowed to update the channel state.
|
// allowed to update the channel state.
|
||||||
type LinkUpdater interface {
|
type LinkUpdater interface {
|
||||||
|
|||||||
@@ -491,15 +491,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, chanDB *channeldb.DB,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
peer.HandleLocalCloseChanReqs(request)
|
||||||
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)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
FwdingLog: chanDB.ForwardingLog(),
|
FwdingLog: chanDB.ForwardingLog(),
|
||||||
SwitchPackager: channeldb.NewSwitchPackager(),
|
SwitchPackager: channeldb.NewSwitchPackager(),
|
||||||
|
|||||||
Reference in new issue
Block a user