diff options
| author | Adam Soltys <[email protected]> | 2021-02-19 13:09:38 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-02-19 13:10:20 -0500 |
| commit | 2d0dcd8a34fe4bc641c0d0653458edb215e572ed (patch) | |
| tree | c0a29ba572a6153d0f51c4b9bada38cfadbfb7fd /lib | |
| parent | b1613d1b0268c06b52c33ed6b9599a68d7b27bbb (diff) | |
| download | coinos-server-2d0dcd8a34fe4bc641c0d0653458edb215e572ed.tar.gz coinos-server-2d0dcd8a34fe4bc641c0d0653458edb215e572ed.zip | |
check for high fee hints
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 |
