mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
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.
This commit is contained in:
@@ -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",
|
||||
|
Reference in New Issue
Block a user