diff --git a/routing/additional_edge.go b/routing/additional_edge.go index a1e5fc856..5f2d42eeb 100644 --- a/routing/additional_edge.go +++ b/routing/additional_edge.go @@ -29,6 +29,11 @@ type AdditionalEdge interface { // EdgePolicy returns the policy of the additional edge. EdgePolicy() *models.CachedEdgePolicy + + // BlindedPayment returns the BlindedPayment that this additional edge + // info was derived from. It will return nil if this edge was not + // derived from a blinded route. + BlindedPayment() *BlindedPayment } // PayloadSizeFunc defines the interface for the payload size function. @@ -60,6 +65,12 @@ func (p *PrivateEdge) IntermediatePayloadSize(amount lnwire.MilliSatoshi, return hop.PayloadSize(channelID) } +// BlindedPayment is a no-op for a PrivateEdge since it is not associated with +// a blinded payment. This will thus return nil. +func (p *PrivateEdge) BlindedPayment() *BlindedPayment { + return nil +} + // BlindedEdge implements the AdditionalEdge interface. Blinded hops are viewed // as additional edges because they are appended at the end of a normal route. type BlindedEdge struct { @@ -120,6 +131,12 @@ func (b *BlindedEdge) IntermediatePayloadSize(_ lnwire.MilliSatoshi, _ uint32, return hop.PayloadSize(0) } +// BlindedPayment returns the blinded payment that this edge is associated +// with. +func (b *BlindedEdge) BlindedPayment() *BlindedPayment { + return b.blindedPayment +} + // Compile-time constraints to ensure the PrivateEdge and the BlindedEdge // implement the AdditionalEdge interface. var _ AdditionalEdge = (*PrivateEdge)(nil)