discovery+graph: get inbound fee directly from ChannelUpdate

Remove the previously added TODOs which would extract InboundFee info
from the ExtraOpaqueData of a ChannelUpdate at the time of
ChannelEdgePolicy construction. These can now be replaced by using the
newly added InboundFee record on the ChannelUpdate message.
This commit is contained in:
Elle Mouton committed 2025-06-09 08:44:47 +02:00
1 parent 420001a98c
commit 6d8bc63ad6
3 files changed
+11 -38

No files matched your search

+1 -20
View File
@@ -3257,29 +3257,10 @@ func (d *AuthenticatedGossiper) handleChanUpdate(ctx context.Context,
MaxHTLC: upd.HtlcMaximumMsat,
FeeBaseMSat: lnwire.MilliSatoshi(upd.BaseFee),
FeeProportionalMillionths: lnwire.MilliSatoshi(upd.FeeRate),
InboundFee: upd.InboundFee.ValOpt(),
ExtraOpaqueData: upd.ExtraOpaqueData,
}
// Extract the inbound fee from the ExtraOpaqueData, if present.
//
// TODO(elle): this can be removed once we define the optional TLV
// field on the lnwire.ChannelUpdate itself.
var inboundFee lnwire.Fee
typeMap, err := upd.ExtraOpaqueData.ExtractRecords(&inboundFee)
if err != nil {
rErr := fmt.Errorf("%w: %w", graphdb.ErrParsingExtraTLVBytes,
err)
log.Error(rErr)
nMsg.err <- rErr
return nil, false
}
val, ok := typeMap[lnwire.FeeRecordType]
if ok && val == nil {
update.InboundFee = fn.Some(inboundFee)
}
if err := d.cfg.Graph.UpdateEdge(update, ops...); err != nil {
if graph.IsError(
err, graph.ErrOutdated,