From 7a604c8d009097d8c02c480ce365ac53c89a8f09 Mon Sep 17 00:00:00 2001 From: MPins Date: Sun, 27 Apr 2025 23:21:07 -0300 Subject: [PATCH] rpcserver: validate blindCfg.MaxNumPaths Assert that the blindCfg.MaxNumPaths value is non-zero. --- rpcserver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 26fbedbcb..fe10fa426 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -6200,6 +6200,10 @@ func (r *rpcServer) AddInvoice(ctx context.Context, blindingRestrictions.NumHops = uint8(*blindCfg.NumHops) } if blindCfg.MaxNumPaths != nil { + if *blindCfg.MaxNumPaths == 0 { + return nil, fmt.Errorf("blinded max num " + + "paths cannot be 0") + } blindingRestrictions.MaxNumPaths = uint8(*blindCfg.MaxNumPaths) }