Merge pull request #10114 from ellemouton/fixPolicySwop
graph/db: fix potential policy swop
This commit is contained in:
1 file changed
+9
-7
@@ -1188,7 +1188,7 @@ func (s *SQLStore) ForEachNodeCached(ctx context.Context,
|
|||||||
var cachedInPolicy *models.CachedEdgePolicy
|
var cachedInPolicy *models.CachedEdgePolicy
|
||||||
if inPolicy != nil {
|
if inPolicy != nil {
|
||||||
cachedInPolicy = models.NewCachedPolicy(
|
cachedInPolicy = models.NewCachedPolicy(
|
||||||
p2,
|
inPolicy,
|
||||||
)
|
)
|
||||||
cachedInPolicy.ToNodePubKey =
|
cachedInPolicy.ToNodePubKey =
|
||||||
toNodeCallback
|
toNodeCallback
|
||||||
@@ -1197,11 +1197,13 @@ func (s *SQLStore) ForEachNodeCached(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var inboundFee lnwire.Fee
|
var inboundFee lnwire.Fee
|
||||||
outPolicy.InboundFee.WhenSome(
|
if outPolicy != nil {
|
||||||
func(fee lnwire.Fee) {
|
outPolicy.InboundFee.WhenSome(
|
||||||
inboundFee = fee
|
func(fee lnwire.Fee) {
|
||||||
},
|
inboundFee = fee
|
||||||
)
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
directedChannel := &DirectedChannel{
|
directedChannel := &DirectedChannel{
|
||||||
ChannelID: e.ChannelID,
|
ChannelID: e.ChannelID,
|
||||||
@@ -1209,7 +1211,7 @@ func (s *SQLStore) ForEachNodeCached(ctx context.Context,
|
|||||||
e.NodeKey1Bytes,
|
e.NodeKey1Bytes,
|
||||||
OtherNode: e.NodeKey2Bytes,
|
OtherNode: e.NodeKey2Bytes,
|
||||||
Capacity: e.Capacity,
|
Capacity: e.Capacity,
|
||||||
OutPolicySet: p1 != nil,
|
OutPolicySet: outPolicy != nil,
|
||||||
InPolicy: cachedInPolicy,
|
InPolicy: cachedInPolicy,
|
||||||
InboundFee: inboundFee,
|
InboundFee: inboundFee,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user