Skip to content

Commit 5305854

Browse files
authored
Merge pull request #5295 from wpaulino/getnodeinfo-policy-order
rpc: fix policy order for GetNodeInfo
2 parents e39d009 + b01437d commit 5305854

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rpcserver.go

+6
Original file line numberDiff line numberDiff line change
@@ -5164,6 +5164,12 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
51645164
func marshalDbEdge(edgeInfo *channeldb.ChannelEdgeInfo,
51655165
c1, c2 *channeldb.ChannelEdgePolicy) *lnrpc.ChannelEdge {
51665166

5167+
// Make sure the policies match the node they belong to. c1 should point
5168+
// to the policy for NodeKey1, and c2 for NodeKey2.
5169+
if c1.ChannelFlags&lnwire.ChanUpdateDirection == 1 {
5170+
c2, c1 = c1, c2
5171+
}
5172+
51675173
// Order the edges by increasing pubkey.
51685174
if bytes.Compare(edgeInfo.NodeKey2Bytes[:],
51695175
edgeInfo.NodeKey1Bytes[:]) < 0 {

0 commit comments

Comments
 (0)