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

@@ -127,12 +127,10 @@ func (r *Manager) UpdatePolicy(newSchema routing.ChannelPolicy,
Edge: edge,
})
// Extract inbound fees from the ExtraOpaqueData.
var inboundWireFee lnwire.Fee
_, err = edge.ExtraOpaqueData.ExtractRecords(&inboundWireFee)
if err != nil {
return err
}
edge.InboundFee.WhenSome(func(fee lnwire.Fee) {
inboundWireFee = fee
})
inboundFee := models.NewInboundFeeFromWire(inboundWireFee)
// Add updated policy to list of policies to send to switch.
@@ -372,6 +370,8 @@ func (r *Manager) updateEdge(chanPoint wire.OutPoint,
err = fn.MapOptionZ(newSchema.InboundFee,
func(f models.InboundFee) error {
inboundWireFee := f.ToWire()
edge.InboundFee = fn.Some(inboundWireFee)
return edge.ExtraOpaqueData.PackRecords(
&inboundWireFee,
)