routerrpc: default timeout_seconds to 60 in SendPaymentV2

If timeout_seconds is not set or is 0, the default value
of 60 seconds will be used.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
This commit is contained in:
Nishant Bansal committed 2025-01-15 19:45:44 +05:30
1 parent 4b16c2902e
commit b577ad4661
5 files changed
+20 -14

No files matched your search

+9
View File
@@ -40,6 +40,10 @@ const (
// routeFeeLimitSat is the maximum routing fee that we allow to occur
// when estimating a routing fee.
routeFeeLimitSat = 100_000_000
// DefaultPaymentTimeout is the default value of time we should spend
// when attempting to fulfill the payment.
DefaultPaymentTimeout int32 = 60
)
var (
@@ -344,6 +348,11 @@ func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispat
func (s *Server) SendPaymentV2(req *SendPaymentRequest,
stream Router_SendPaymentV2Server) error {
// Set payment request attempt timeout.
if req.TimeoutSeconds == 0 {
req.TimeoutSeconds = DefaultPaymentTimeout
}
payment, err := s.cfg.RouterBackend.extractIntentFromSendRequest(req)
if err != nil {
return err