htlcswitch: fix panic when receiving close req for unknown channel
This commit is contained in:
parent
12f69692aa
commit
00a4da3b8c
@ -658,8 +658,13 @@ func (h *htlcSwitch) handleCloseLink(req *closeLinkReq) {
|
|||||||
// channel's available bandwidth by the delta specified within the message.
|
// channel's available bandwidth by the delta specified within the message.
|
||||||
func (h *htlcSwitch) handleLinkUpdate(req *linkInfoUpdateMsg) {
|
func (h *htlcSwitch) handleLinkUpdate(req *linkInfoUpdateMsg) {
|
||||||
h.chanIndexMtx.RLock()
|
h.chanIndexMtx.RLock()
|
||||||
link := h.chanIndex[*req.targetLink]
|
link, ok := h.chanIndex[*req.targetLink]
|
||||||
h.chanIndexMtx.RUnlock()
|
h.chanIndexMtx.RUnlock()
|
||||||
|
if !ok {
|
||||||
|
hswcLog.Errorf("received link update for non-existent link: %v",
|
||||||
|
req.targetLink)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
atomic.AddInt64(&link.availableBandwidth, int64(req.bandwidthDelta))
|
atomic.AddInt64(&link.availableBandwidth, int64(req.bandwidthDelta))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user