mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user