Merge pull request #5295 from wpaulino/getnodeinfo-policy-order
rpc: fix policy order for GetNodeInfo
This commit is contained in:
commit
5305854c2b
@ -5164,6 +5164,12 @@ 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 {
|
||||||
|
|
||||||
|
// Make sure the policies match the node they belong to. c1 should point
|
||||||
|
// to the policy for NodeKey1, and c2 for NodeKey2.
|
||||||
|
if c1.ChannelFlags&lnwire.ChanUpdateDirection == 1 {
|
||||||
|
c2, c1 = c1, c2
|
||||||
|
}
|
||||||
|
|
||||||
// Order the edges by increasing pubkey.
|
// Order the edges by increasing pubkey.
|
||||||
if bytes.Compare(edgeInfo.NodeKey2Bytes[:],
|
if bytes.Compare(edgeInfo.NodeKey2Bytes[:],
|
||||||
edgeInfo.NodeKey1Bytes[:]) < 0 {
|
edgeInfo.NodeKey1Bytes[:]) < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user