rpcserver: validate blindCfg.MaxNumPaths
Assert that the blindCfg.MaxNumPaths value is non-zero.
This commit is contained in:
1 file changed
+4
@@ -6200,6 +6200,10 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
|
|||||||
blindingRestrictions.NumHops = uint8(*blindCfg.NumHops)
|
blindingRestrictions.NumHops = uint8(*blindCfg.NumHops)
|
||||||
}
|
}
|
||||||
if blindCfg.MaxNumPaths != nil {
|
if blindCfg.MaxNumPaths != nil {
|
||||||
|
if *blindCfg.MaxNumPaths == 0 {
|
||||||
|
return nil, fmt.Errorf("blinded max num " +
|
||||||
|
"paths cannot be 0")
|
||||||
|
}
|
||||||
blindingRestrictions.MaxNumPaths =
|
blindingRestrictions.MaxNumPaths =
|
||||||
uint8(*blindCfg.MaxNumPaths)
|
uint8(*blindCfg.MaxNumPaths)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user