mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-18 22:54:26 +01:00
Merge pull request #5303 from guggero/policy-nil-check
rpcserver: add nil check to policy ordering
This commit is contained in:
@@ -5166,13 +5166,8 @@ func marshalDbEdge(edgeInfo *channeldb.ChannelEdgeInfo,
|
|||||||
|
|
||||||
// Make sure the policies match the node they belong to. c1 should point
|
// Make sure the policies match the node they belong to. c1 should point
|
||||||
// to the policy for NodeKey1, and c2 for NodeKey2.
|
// to the policy for NodeKey1, and c2 for NodeKey2.
|
||||||
if c1.ChannelFlags&lnwire.ChanUpdateDirection == 1 {
|
if c1 != nil && c1.ChannelFlags&lnwire.ChanUpdateDirection == 1 ||
|
||||||
c2, c1 = c1, c2
|
c2 != nil && c2.ChannelFlags&lnwire.ChanUpdateDirection == 0 {
|
||||||
}
|
|
||||||
|
|
||||||
// Order the edges by increasing pubkey.
|
|
||||||
if bytes.Compare(edgeInfo.NodeKey2Bytes[:],
|
|
||||||
edgeInfo.NodeKey1Bytes[:]) < 0 {
|
|
||||||
|
|
||||||
c2, c1 = c1, c2
|
c2, c1 = c1, c2
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user