lncli: Make output of lncli sane and readable

LIGHT-133, LIGHT-138 Make output of `lncli showrouting table` in
two different formats: table and json.
Instead of sending serialized routing table send list of channels.
This commit is contained in:
BitfuryLightning committed 2016-09-06 20:01:21 -04:00
1 parent d764493d25
commit b5f07ede46
5 files changed
+272 -109

No files matched your search

+13 -1
View File
@@ -512,7 +512,19 @@ func (r *rpcServer) ShowRoutingTable(ctx context.Context,
in *lnrpc.ShowRoutingTableRequest) (*lnrpc.ShowRoutingTableResponse, error) {
rpcsLog.Debugf("[ShowRoutingTable]")
rtCopy := r.server.routingMgr.GetRTCopy()
channels := make([]*lnrpc.RTChannel, 0)
for _, channel := range rtCopy.AllChannels() {
channels = append(channels,
&lnrpc.RTChannel{
Id1: channel.Id1.String(),
Id2: channel.Id2.String(),
EdgeID: channel.EdgeID.String(),
Capacity: channel.Info.Capacity(),
Weight: channel.Info.Weight(),
},
)
}
return &lnrpc.ShowRoutingTableResponse{
Rt: rtCopy.String(),
Channels: channels,
}, nil
}