From 1d162216e65873c024b7b2e48417ad9fb4e48106 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 4 Jun 2025 12:37:09 +0200 Subject: [PATCH] peer: stop extracting InboundFees Like the previous commit, here we can start directly using the InboundFee on the models.ChannelEdgePolicy object since we know we read it from disk and so the InboundFee field will be populated accordingly. NOTE: unlike the previous commit, behaviour is slightly different here since previously we would error out here if TLV parsing failed whereas now, the DB call will just skip the error and return a nil policy. This should be ok since this is explicitly only dealing with our own updates and so our TLV should always be valid. --- peer/brontide.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/peer/brontide.go b/peer/brontide.go index 26d02d3e7..5d00e14ab 100644 --- a/peer/brontide.go +++ b/peer/brontide.go @@ -1205,27 +1205,17 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) ( // routing policy into a forwarding policy. var forwardingPolicy *models.ForwardingPolicy if selfPolicy != nil { - var inboundWireFee lnwire.Fee - _, err := selfPolicy.ExtraOpaqueData.ExtractRecords( - &inboundWireFee, - ) - if err != nil { - return nil, err - } - - inboundFee := models.NewInboundFeeFromWire( - inboundWireFee, - ) - forwardingPolicy = &models.ForwardingPolicy{ MinHTLCOut: selfPolicy.MinHTLC, MaxHTLC: selfPolicy.MaxHTLC, BaseFee: selfPolicy.FeeBaseMSat, FeeRate: selfPolicy.FeeProportionalMillionths, TimeLockDelta: uint32(selfPolicy.TimeLockDelta), - - InboundFee: inboundFee, } + selfPolicy.InboundFee.WhenSome(func(fee lnwire.Fee) { + inboundFee := models.NewInboundFeeFromWire(fee) + forwardingPolicy.InboundFee = inboundFee + }) } else { p.log.Warnf("Unable to find our forwarding policy "+ "for channel %v, using default values",