Merge pull request #3427 from cfromknecht/node-info-update-order
rpcserver: order updates in getnodeinfo by increasing pubkey
This commit is contained in:
commit
281c535b49
14
rpcserver.go
14
rpcserver.go
@ -3770,16 +3770,20 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
|
|||||||
func marshalDbEdge(edgeInfo *channeldb.ChannelEdgeInfo,
|
func marshalDbEdge(edgeInfo *channeldb.ChannelEdgeInfo,
|
||||||
c1, c2 *channeldb.ChannelEdgePolicy) *lnrpc.ChannelEdge {
|
c1, c2 *channeldb.ChannelEdgePolicy) *lnrpc.ChannelEdge {
|
||||||
|
|
||||||
var (
|
// Order the edges by increasing pubkey.
|
||||||
lastUpdate int64
|
if bytes.Compare(edgeInfo.NodeKey2Bytes[:],
|
||||||
)
|
edgeInfo.NodeKey1Bytes[:]) < 0 {
|
||||||
|
|
||||||
if c2 != nil {
|
c2, c1 = c1, c2
|
||||||
lastUpdate = c2.LastUpdate.Unix()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastUpdate int64
|
||||||
if c1 != nil {
|
if c1 != nil {
|
||||||
lastUpdate = c1.LastUpdate.Unix()
|
lastUpdate = c1.LastUpdate.Unix()
|
||||||
}
|
}
|
||||||
|
if c2 != nil && c2.LastUpdate.Unix() > lastUpdate {
|
||||||
|
lastUpdate = c2.LastUpdate.Unix()
|
||||||
|
}
|
||||||
|
|
||||||
edge := &lnrpc.ChannelEdge{
|
edge := &lnrpc.ChannelEdge{
|
||||||
ChannelId: edgeInfo.ChannelID,
|
ChannelId: edgeInfo.ChannelID,
|
||||||
|
Loading…
Reference in New Issue
Block a user