mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 22:24:21 +01:00
multi: validate payment params at RPC layer
With this patch, we'll fail out earlier in the cycle in case of some wonky parameters, and not leave zombie payments in the router which currently are not cleaned up.
This commit is contained in:
@@ -4374,6 +4374,15 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
|
||||
payIntent.cltvDelta = uint16(r.cfg.Bitcoin.TimeLockDelta)
|
||||
}
|
||||
|
||||
// Do bounds checking with the block padding so the router isn't left
|
||||
// with a zombie payment in case the user messes up.
|
||||
err = routing.ValidateCLTVLimit(
|
||||
payIntent.cltvLimit, payIntent.cltvDelta, true,
|
||||
)
|
||||
if err != nil {
|
||||
return payIntent, err
|
||||
}
|
||||
|
||||
// If the user is manually specifying payment details, then the payment
|
||||
// hash may be encoded as a string.
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user