rpcserver: fix pendingchannels panic

This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-02-21 16:39:16 -08:00
1 parent 630916b323
commit 69faebfcae
1 file changed
+6 -1
+6 -1
View File
@@ -762,12 +762,17 @@ func (r *rpcServer) PendingChannels(ctx context.Context,
if includeOpen { if includeOpen {
pendingOpenChans := r.server.fundingMgr.PendingChannels() pendingOpenChans := r.server.fundingMgr.PendingChannels()
for _, pendingOpen := range pendingOpenChans { for _, pendingOpen := range pendingOpenChans {
channelPointStr := "<non initialized yet>"
if pendingOpen.channelPoint != nil {
channelPointStr = pendingOpen.channelPoint.String()
}
// TODO(roasbeef): add confirmation progress // TODO(roasbeef): add confirmation progress
pub := pendingOpen.identityPub.SerializeCompressed() pub := pendingOpen.identityPub.SerializeCompressed()
pendingChan := &lnrpc.PendingChannelResponse_PendingChannel{ pendingChan := &lnrpc.PendingChannelResponse_PendingChannel{
PeerId: pendingOpen.peerId, PeerId: pendingOpen.peerId,
IdentityKey: hex.EncodeToString(pub), IdentityKey: hex.EncodeToString(pub),
ChannelPoint: pendingOpen.channelPoint.String(), ChannelPoint: channelPointStr,
Capacity: int64(pendingOpen.capacity), Capacity: int64(pendingOpen.capacity),
LocalBalance: int64(pendingOpen.localBalance), LocalBalance: int64(pendingOpen.localBalance),
RemoteBalance: int64(pendingOpen.remoteBalance), RemoteBalance: int64(pendingOpen.remoteBalance),