rpcserver: remove duplicate info from RoutingPolicy
We remove the inbound fee record from `RoutingPolicy.CustomRecords` as we already have fields `InboundFeeBaseMsat` and `InboundFeeRateMilliMsat`.
This commit is contained in:
1 file changed
+16
-8
+16
-8
@@ -6842,12 +6842,23 @@ func marshalDBEdge(edgeInfo *models.ChannelEdgeInfo,
|
|||||||
return edge
|
return edge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// marshalPolicyExtraOpaqueData marshals the given tlv data and filters out
|
||||||
|
// inbound fee record.
|
||||||
|
func marshalPolicyExtraOpaqueData(data []byte) map[uint64][]byte {
|
||||||
|
records := marshalExtraOpaqueData(data)
|
||||||
|
|
||||||
|
// Remove the inbound fee record as we have dedicated fields for it.
|
||||||
|
delete(records, uint64(lnwire.FeeRecordType))
|
||||||
|
|
||||||
|
return records
|
||||||
|
}
|
||||||
|
|
||||||
func marshalDBRoutingPolicy(
|
func marshalDBRoutingPolicy(
|
||||||
policy *models.ChannelEdgePolicy) *lnrpc.RoutingPolicy {
|
policy *models.ChannelEdgePolicy) *lnrpc.RoutingPolicy {
|
||||||
|
|
||||||
disabled := policy.ChannelFlags&lnwire.ChanUpdateDisabled != 0
|
disabled := policy.ChannelFlags&lnwire.ChanUpdateDisabled != 0
|
||||||
|
|
||||||
customRecords := marshalExtraOpaqueData(policy.ExtraOpaqueData)
|
customRecords := marshalPolicyExtraOpaqueData(policy.ExtraOpaqueData)
|
||||||
inboundFee := policy.InboundFee.UnwrapOr(lnwire.Fee{})
|
inboundFee := policy.InboundFee.UnwrapOr(lnwire.Fee{})
|
||||||
|
|
||||||
return &lnrpc.RoutingPolicy{
|
return &lnrpc.RoutingPolicy{
|
||||||
@@ -7361,7 +7372,7 @@ func marshallTopologyChange(
|
|||||||
channelUpdates := make([]*lnrpc.ChannelEdgeUpdate, len(topChange.ChannelEdgeUpdates))
|
channelUpdates := make([]*lnrpc.ChannelEdgeUpdate, len(topChange.ChannelEdgeUpdates))
|
||||||
for i, channelUpdate := range topChange.ChannelEdgeUpdates {
|
for i, channelUpdate := range topChange.ChannelEdgeUpdates {
|
||||||
|
|
||||||
customRecords := marshalExtraOpaqueData(
|
customRecords := marshalPolicyExtraOpaqueData(
|
||||||
channelUpdate.ExtraOpaqueData,
|
channelUpdate.ExtraOpaqueData,
|
||||||
)
|
)
|
||||||
inboundFee := channelUpdate.InboundFee.UnwrapOr(lnwire.Fee{})
|
inboundFee := channelUpdate.InboundFee.UnwrapOr(lnwire.Fee{})
|
||||||
@@ -7954,12 +7965,9 @@ func (r *rpcServer) UpdateChannelPolicy(ctx context.Context,
|
|||||||
MinHTLC: minHtlc,
|
MinHTLC: minHtlc,
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcsLog.Debugf("[updatechanpolicy] updating channel policy "+
|
rpcsLog.Debugf("[updatechanpolicy] updating channel policy, "+
|
||||||
"base_fee=%v, rate_fixed=%v, time_lock_delta: %v, "+
|
"targets=%v, req=%v", lnutils.SpewLogClosure(targetChans),
|
||||||
"min_htlc=%v, max_htlc=%v, targets=%v",
|
lnutils.SpewLogClosure(req))
|
||||||
req.BaseFeeMsat, feeRateFixed, req.TimeLockDelta,
|
|
||||||
minHtlc, maxHtlc,
|
|
||||||
spew.Sdump(targetChans))
|
|
||||||
|
|
||||||
// With the scope resolved, we'll now send this to the local channel
|
// With the scope resolved, we'll now send this to the local channel
|
||||||
// manager so it can propagate the new policy for our target channel(s).
|
// manager so it can propagate the new policy for our target channel(s).
|
||||||
|
|||||||
Reference in new issue
Block a user