diff --git a/rpcserver.go b/rpcserver.go index 5cb959c5..c6776ac1 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3770,16 +3770,20 @@ func (r *rpcServer) DescribeGraph(ctx context.Context, func marshalDbEdge(edgeInfo *channeldb.ChannelEdgeInfo, c1, c2 *channeldb.ChannelEdgePolicy) *lnrpc.ChannelEdge { - var ( - lastUpdate int64 - ) + // Order the edges by increasing pubkey. + if bytes.Compare(edgeInfo.NodeKey2Bytes[:], + edgeInfo.NodeKey1Bytes[:]) < 0 { - if c2 != nil { - lastUpdate = c2.LastUpdate.Unix() + c2, c1 = c1, c2 } + + var lastUpdate int64 if c1 != nil { lastUpdate = c1.LastUpdate.Unix() } + if c2 != nil && c2.LastUpdate.Unix() > lastUpdate { + lastUpdate = c2.LastUpdate.Unix() + } edge := &lnrpc.ChannelEdge{ ChannelId: edgeInfo.ChannelID,