mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 02:52:49 +02:00
graph/db: use InboundFee directly from ChannelEdgePolicy
Now that we know that the InboundFee on the ChannelEdgePolicy is always set appropriately, we can update the GraphCache UpdatePolicy method to take the InboundFee directly from the ChannelEdgePolicy object.
This commit is contained in:
@@ -666,15 +666,25 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
getExtraData := func(
|
||||
end *testChannelEnd) lnwire.ExtraOpaqueData {
|
||||
getInboundFees := func(
|
||||
end *testChannelEnd) fn.Option[lnwire.Fee] {
|
||||
|
||||
var extraData lnwire.ExtraOpaqueData
|
||||
inboundFee := lnwire.Fee{
|
||||
BaseFee: int32(end.InboundFeeBaseMsat),
|
||||
FeeRate: int32(end.InboundFeeRate),
|
||||
}
|
||||
require.NoError(t, extraData.PackRecords(&inboundFee))
|
||||
|
||||
return fn.Some(inboundFee)
|
||||
}
|
||||
getExtraData := func(
|
||||
end *testChannelEnd) lnwire.ExtraOpaqueData {
|
||||
|
||||
var extraData lnwire.ExtraOpaqueData
|
||||
|
||||
inboundFee := getInboundFees(end)
|
||||
inboundFee.WhenSome(func(fee lnwire.Fee) {
|
||||
require.NoError(t, extraData.PackRecords(&fee))
|
||||
})
|
||||
|
||||
return extraData
|
||||
}
|
||||
@@ -701,6 +711,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
FeeBaseMSat: node1.FeeBaseMsat,
|
||||
FeeProportionalMillionths: node1.FeeRate,
|
||||
ToNode: node2Vertex,
|
||||
InboundFee: getInboundFees(node1), //nolint:ll
|
||||
ExtraOpaqueData: getExtraData(node1),
|
||||
}
|
||||
if err := graph.UpdateEdgePolicy(edgePolicy); err != nil {
|
||||
@@ -731,6 +742,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
FeeBaseMSat: node2.FeeBaseMsat,
|
||||
FeeProportionalMillionths: node2.FeeRate,
|
||||
ToNode: node1Vertex,
|
||||
InboundFee: getInboundFees(node2), //nolint:ll
|
||||
ExtraOpaqueData: getExtraData(node2),
|
||||
}
|
||||
if err := graph.UpdateEdgePolicy(edgePolicy); err != nil {
|
||||
|
Reference in New Issue
Block a user