diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/send.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/send.js b/lib/send.js index 6aff80c4..6952368c 100644 --- a/lib/send.js +++ b/lib/send.js @@ -3,6 +3,12 @@ const { Op } = require("sequelize"); send = async (amount, memo, hash, user) => { let payreq = bolt11.decode(hash); + let routingInfo = payreq.tags.find(t => t.tagName === "routing_info"); + if ( + routingInfo && + routingInfo.data.find(d => d.fee_proportional_millionths > 100) + ) + throw new Error("Fee rate too high"); if (!amount || payreq.satoshis > amount) amount = payreq.satoshis; @@ -21,7 +27,7 @@ send = async (amount, memo, hash, user) => { pubkey: null, balance: { [Op.gte]: amount - }, + } }, lock: transaction.LOCK.UPDATE, transaction |
