mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 23:02:33 +02:00
routing: dont include final hop cltv in blinded path
Only include the final hop's cltv delta in the total timelock calculation if the route does not include a blinded path. This is because in a blinded path, the final hops final cltv delta will be included in the blinded path's accumlated cltv delta value. With this commit, we remove the responsibility of remembering not to set the `finalHop.cltvDelta` from the caller of `newRoute`. The relevant test is updated accordingly.
This commit is contained in:
@@ -1099,8 +1099,13 @@ var queryRoutesCommand = cli.Command{
|
||||
},
|
||||
cli.Int64Flag{
|
||||
Name: "final_cltv_delta",
|
||||
Usage: "(optional) number of blocks the last hop has to reveal " +
|
||||
"the preimage",
|
||||
Usage: "(optional) number of blocks the last hop has " +
|
||||
"to reveal the preimage. Note that this " +
|
||||
"should not be set in the case where the " +
|
||||
"path includes a blinded path since in " +
|
||||
"that case, the receiver will already have " +
|
||||
"accounted for this value in the " +
|
||||
"blinded_cltv value",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "use_mc",
|
||||
@@ -1238,6 +1243,13 @@ func parseBlindedPaymentParameters(ctx *cli.Context) (
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// If a blinded path has been provided, then the final_cltv_delta flag
|
||||
// should not be provided since this value will be ignored.
|
||||
if ctx.IsSet("final_cltv_delta") {
|
||||
return nil, fmt.Errorf("`final_cltv_delta` should not be " +
|
||||
"provided if a blinded path is provided")
|
||||
}
|
||||
|
||||
// If any one of our blinding related flags is set, we expect the
|
||||
// full set to be set and we'll error out accordingly.
|
||||
introNode, err := route.NewVertexFromStr(
|
||||
|
Reference in New Issue
Block a user