rpcserver: lookup num pending channels from chanDB

This commit is contained in:
Conner Fromknecht 2017-08-08 18:01:15 -07:00 committed by Olaoluwa Osuntokun
parent 39344b6445
commit 13b78fea1f

@ -812,11 +812,12 @@ func (r *rpcServer) GetInfo(ctx context.Context,
activeChannels += uint32(len(serverPeer.ChannelSnapshots())) activeChannels += uint32(len(serverPeer.ChannelSnapshots()))
} }
pendingChannels, err := r.server.fundingMgr.NumPendingChannels() pendingChannels, err := r.server.chanDB.FetchPendingChannels()
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to get number of pending "+ return nil, fmt.Errorf("unable to get retrieve pending "+
"channels: %v", err) "channels: %v", err)
} }
nPendingChannels := uint32(len(pendingChannels))
idPub := r.server.identityPriv.PubKey().SerializeCompressed() idPub := r.server.identityPriv.PubKey().SerializeCompressed()
@ -839,7 +840,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
// TODO(roasbeef): add synced height n stuff // TODO(roasbeef): add synced height n stuff
return &lnrpc.GetInfoResponse{ return &lnrpc.GetInfoResponse{
IdentityPubkey: hex.EncodeToString(idPub), IdentityPubkey: hex.EncodeToString(idPub),
NumPendingChannels: pendingChannels, NumPendingChannels: nPendingChannels,
NumActiveChannels: activeChannels, NumActiveChannels: activeChannels,
NumPeers: uint32(len(serverPeers)), NumPeers: uint32(len(serverPeers)),
BlockHeight: uint32(bestHeight), BlockHeight: uint32(bestHeight),