lnrpc: added rpc support for querying a channel's satoshis sent/received

Added total_satoshis_sent and total_satoshis_received fields to the
ListChannels RPC call.
This commit is contained in:
bryanvu
2016-11-18 16:20:44 -08:00
committed by Olaoluwa Osuntokun
parent faf9daddf6
commit 2bf5794645
5 changed files with 280 additions and 218 deletions

View File

@@ -551,13 +551,15 @@ func (r *rpcServer) ListChannels(ctx context.Context,
nodeID := hex.EncodeToString(nodePub)
channel := &lnrpc.ActiveChannel{
RemotePubkey: nodeID,
ChannelPoint: dbChannel.ChanID.String(),
Capacity: int64(dbChannel.Capacity),
LocalBalance: int64(dbChannel.OurBalance),
RemoteBalance: int64(dbChannel.TheirBalance),
NumUpdates: dbChannel.NumUpdates,
PendingHtlcs: make([]*lnrpc.HTLC, len(dbChannel.Htlcs)),
RemotePubkey: nodeID,
ChannelPoint: dbChannel.ChanID.String(),
Capacity: int64(dbChannel.Capacity),
LocalBalance: int64(dbChannel.OurBalance),
RemoteBalance: int64(dbChannel.TheirBalance),
TotalSatoshisSent: int64(dbChannel.TotalSatoshisSent),
TotalSatoshisReceived: int64(dbChannel.TotalSatoshisReceived),
NumUpdates: dbChannel.NumUpdates,
PendingHtlcs: make([]*lnrpc.HTLC, len(dbChannel.Htlcs)),
}
for i, htlc := range dbChannel.Htlcs {