mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-25 22:36:57 +02:00
record+htlcswitch: convert BlindedRouteData fields to optional
For the final hop in a blinded route, the SCID and RelayInfo fields will _not_ be set. So these fields need to be converted to optional records. The existing BlindedRouteData constructor is also renamed to `NewNonFinalBlindedRouteData` in preparation for a `NewFinalBlindedRouteData` constructor which will be used to construct the blinded data for the final hop which will contain a much smaller set of data. The SCID and RelayInfo parameters of the constructor are left as non-pointers in order to force the caller to set them in the case that the constructor is called for non-final nodes. The other option would be to create a single constructor where all parameters are optional but I think this makes it easier for the caller to make a mistake.
This commit is contained in:
@@ -676,7 +676,7 @@ func (b *blindedForwardTest) createBlindedRoute(hops []*forwardingEdge,
|
||||
|
||||
// Encode the route's blinded data and include it in the
|
||||
// blinded hop.
|
||||
payload := record.NewBlindedRouteData(
|
||||
payload := record.NewNonFinalBlindedRouteData(
|
||||
scid, nil, *relayInfo, constraints, nil,
|
||||
)
|
||||
payloadBytes, err := record.EncodeBlindedRouteData(payload)
|
||||
@@ -739,7 +739,7 @@ func (b *blindedForwardTest) createBlindedRoute(hops []*forwardingEdge,
|
||||
// node ID here so that it _looks like_ a valid
|
||||
// forwarding hop (though in reality it's the last
|
||||
// hop).
|
||||
record.NewBlindedRouteData(
|
||||
record.NewNonFinalBlindedRouteData(
|
||||
lnwire.NewShortChanIDFromInt(100), nil,
|
||||
record.PaymentRelayInfo{}, nil, nil,
|
||||
),
|
||||
|
Reference in New Issue
Block a user