From 5560f032f62abe82364eaa6e1b5d79234472da1e Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 16 Feb 2017 19:35:22 +0800 Subject: [PATCH] rpc+routing: fix panic when channel edge but no edge info in db --- routing/router.go | 2 ++ rpcserver.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/routing/router.go b/routing/router.go index 1775d08e..5f7c1631 100644 --- a/routing/router.go +++ b/routing/router.go @@ -831,6 +831,8 @@ func (r *ChannelRouter) syncChannelGraph(syncReq *syncRequest) error { chanID = lnwire.NewChanIDFromInt(e1.ChannelID) case e2 != nil: chanID = lnwire.NewChanIDFromInt(e2.ChannelID) + case e1 == nil && e2 == nil: + return nil default: chanID = lnwire.NewChanIDFromInt(e1.ChannelID) } diff --git a/rpcserver.go b/rpcserver.go index 23aa2ba7..95de1dc2 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1601,6 +1601,8 @@ func (r *rpcServer) GetNetworkInfo(context.Context, *lnrpc.NetworkInfoRequest) ( chanCapacity = c2.Capacity case c2 == nil: chanCapacity = c1.Capacity + case c1 == nil && c2 == nil: + return nil default: chanCapacity = c1.Capacity }