multi: set the InboundFee on ChannelEdgePolicy

In this commit, we make sure to set the new field wherever appropriate.
This will be any place where the ChannelEdgePolicy is constructed other
than its disk deserialisation.
This commit is contained in:
Elle Mouton
2025-06-04 12:48:59 +02:00
parent 1d162216e6
commit 9890d74622
4 changed files with 47 additions and 7 deletions

View File

@@ -3260,6 +3260,26 @@ func (d *AuthenticatedGossiper) handleChanUpdate(ctx context.Context,
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,