Skip to content

Commit 1d16221

Browse files
committed
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.
1 parent e170ad4 commit 1d16221

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

peer/brontide.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,27 +1205,17 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) (
12051205
// routing policy into a forwarding policy.
12061206
var forwardingPolicy *models.ForwardingPolicy
12071207
if selfPolicy != nil {
1208-
var inboundWireFee lnwire.Fee
1209-
_, err := selfPolicy.ExtraOpaqueData.ExtractRecords(
1210-
&inboundWireFee,
1211-
)
1212-
if err != nil {
1213-
return nil, err
1214-
}
1215-
1216-
inboundFee := models.NewInboundFeeFromWire(
1217-
inboundWireFee,
1218-
)
1219-
12201208
forwardingPolicy = &models.ForwardingPolicy{
12211209
MinHTLCOut: selfPolicy.MinHTLC,
12221210
MaxHTLC: selfPolicy.MaxHTLC,
12231211
BaseFee: selfPolicy.FeeBaseMSat,
12241212
FeeRate: selfPolicy.FeeProportionalMillionths,
12251213
TimeLockDelta: uint32(selfPolicy.TimeLockDelta),
1226-
1227-
InboundFee: inboundFee,
12281214
}
1215+
selfPolicy.InboundFee.WhenSome(func(fee lnwire.Fee) {
1216+
inboundFee := models.NewInboundFeeFromWire(fee)
1217+
forwardingPolicy.InboundFee = inboundFee
1218+
})
12291219
} else {
12301220
p.log.Warnf("Unable to find our forwarding policy "+
12311221
"for channel %v, using default values",

0 commit comments

Comments
 (0)