diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index 290c2f54c..51a1d8483 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -482,16 +482,6 @@ func (c *KVStore) forEachNodeDirectedChannel(tx kvdb.RTx, cachedInPolicy.ToNodeFeatures = toNodeFeatures } - var inboundFee lnwire.Fee - if p1 != nil { - // Extract inbound fee. If there is a decoding error, - // skip this edge. - _, err := p1.ExtraOpaqueData.ExtractRecords(&inboundFee) - if err != nil { - return nil - } - } - directedChannel := &DirectedChannel{ ChannelID: e.ChannelID, IsNode1: node == e.NodeKey1Bytes, @@ -499,7 +489,12 @@ func (c *KVStore) forEachNodeDirectedChannel(tx kvdb.RTx, Capacity: e.Capacity, OutPolicySet: p1 != nil, InPolicy: cachedInPolicy, - InboundFee: inboundFee, + } + + if p1 != nil { + p1.InboundFee.WhenSome(func(fee lnwire.Fee) { + directedChannel.InboundFee = fee + }) } if node == e.NodeKey2Bytes { diff --git a/rpcserver.go b/rpcserver.go index 79d91e646..f9f8a5a9c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -6842,7 +6842,7 @@ func marshalDBRoutingPolicy( disabled := policy.ChannelFlags&lnwire.ChanUpdateDisabled != 0 customRecords := marshalExtraOpaqueData(policy.ExtraOpaqueData) - inboundFee := extractInboundFeeSafe(policy.ExtraOpaqueData) + inboundFee := policy.InboundFee.UnwrapOr(lnwire.Fee{}) return &lnrpc.RoutingPolicy{ TimeLockDelta: uint32(policy.TimeLockDelta), @@ -7698,14 +7698,9 @@ func (r *rpcServer) FeeReport(ctx context.Context, edgePolicy.FeeProportionalMillionths feeRate := float64(feeRateFixedPoint) / feeBase - // Decode inbound fee from extra data. - var inboundFee lnwire.Fee - _, err := edgePolicy.ExtraOpaqueData.ExtractRecords( - &inboundFee, + inboundFee := edgePolicy.InboundFee.UnwrapOr( + lnwire.Fee{}, ) - if err != nil { - return err - } // TODO(roasbeef): also add stats for revenue for each // channel