mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-03 20:16:02 +02:00
lnrpc: add field denoting if channel peer is online in ListChannels
This commit adds a new field to the ListChannels RPC command which indicates if the peer is currently online or not. This is useful as UI’s will be able to use this information to communicate the availability of each channel to an end user.
This commit is contained in:
10
rpcserver.go
10
rpcserver.go
@ -813,8 +813,8 @@ func (r *rpcServer) ListChannels(ctx context.Context,
|
||||
continue
|
||||
}
|
||||
|
||||
nodePub := dbChannel.IdentityPub.SerializeCompressed()
|
||||
nodeID := hex.EncodeToString(nodePub)
|
||||
nodePub := dbChannel.IdentityPub
|
||||
nodeID := hex.EncodeToString(nodePub.SerializeCompressed())
|
||||
chanPoint := dbChannel.ChanID
|
||||
|
||||
// With the channel point known, retrieve the network channel
|
||||
@ -822,7 +822,13 @@ func (r *rpcServer) ListChannels(ctx context.Context,
|
||||
var chanID uint64
|
||||
chanID, _ = graph.ChannelID(chanPoint)
|
||||
|
||||
var peerOnline bool
|
||||
if _, err := r.server.findPeer(nodePub); err == nil {
|
||||
peerOnline = true
|
||||
}
|
||||
|
||||
channel := &lnrpc.ActiveChannel{
|
||||
Active: peerOnline,
|
||||
RemotePubkey: nodeID,
|
||||
ChannelPoint: chanPoint.String(),
|
||||
ChanId: chanID,
|
||||
|
Reference in New Issue
Block a user