diff --git a/src/routes.js b/src/routes.js index d008cc66..dcc47eb8 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1190,6 +1190,20 @@ module.exports = async ( }) } + if (!isARealUsableNumber(feeLimit)) { + return res.status(400).json({ + field: 'feeLimit', + errorMessage: 'Not an usable number' + }) + } + + if (feeLimit < 1) { + return res.status(400).json({ + field: 'feeLimit', + errorMessage: 'Must be 1 or greater.' + }) + } + return res .status(200) .json(await GunActions.sendSpontaneousPayment(to, amt, memo, feeLimit)) diff --git a/utils/lightningServices/v2.js b/utils/lightningServices/v2.js index f0b0a80b..ee6204a9 100644 --- a/utils/lightningServices/v2.js +++ b/utils/lightningServices/v2.js @@ -284,7 +284,9 @@ const sendPaymentV2Keysend = params => { } = params if (!isValidSendPaymentKeysendParams(params)) { - throw new TypeError('Invalid SendPaymentKeysendParams') + throw new TypeError( + `Invalid SendPaymentKeysendParams: ${JSON.stringify(params)}` + ) } const preimage = Crypto.randomBytes(32) @@ -321,7 +323,9 @@ const sendPaymentV2Invoice = params => { } = params if (!isValidSendPaymentInvoiceParams(params)) { - throw new TypeError('Invalid SendPaymentInvoiceParams') + throw new TypeError( + `Invalid SendPaymentInvoiceParams: ${JSON.stringify(params)}` + ) } return sendPaymentV2({