aboutsummaryrefslogtreecommitdiffstats
path: root/routes/liquid
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-03-19 14:37:20 -0700
committerAdam Soltys <[email protected]>2021-03-19 14:37:22 -0700
commit70c8455d9920755b1b925046d46c486a313944c9 (patch)
tree4abd9282fcbe9dda76b8e88682262209b5269850 /routes/liquid
parentb4606c0604eada8cdbd372c33f5faa39912b88d9 (diff)
downloadcoinos-server-70c8455d9920755b1b925046d46c486a313944c9.tar.gz
coinos-server-70c8455d9920755b1b925046d46c486a313944c9.zip
check conversion limit
Diffstat (limited to 'routes/liquid')
-rw-r--r--routes/liquid/fee.js2
-rw-r--r--routes/liquid/send.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/routes/liquid/fee.js b/routes/liquid/fee.js
index 82bb7604..1f5c1deb 100644
--- a/routes/liquid/fee.js
+++ b/routes/liquid/fee.js
@@ -74,7 +74,7 @@ module.exports = ah(async (req, res) => {
try {
res.send(await liquidTx({ ...req.body, user: req.user }));
} catch (e) {
- l.error("error estimating liquid fee", e.message);
+ l.error("error estimating liquid fee", e.message, e.stack);
return res.status(500).send(e.message);
}
});
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index ee62c1b8..ab28471e 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -1,7 +1,7 @@
const btc = config.liquid.btcasset;
const lcad = config.liquid.cadasset;
-sendLiquid = async ({ user, address, memo, tx }) => {
+sendLiquid = async ({ user, address, memo, tx, limit }) => {
const isChange = async address =>
(await lq.getAddressInfo(address)).ismine &&
!Object.keys(addresses).includes(address);
@@ -67,6 +67,8 @@ sendLiquid = async ({ user, address, memo, tx }) => {
}
}
+ if (limit && total > limit) throw new Error("Tx amount exceeds authorized amount");
+
if (asset !== btc || total) {
l.info("creating liquid payment", user.username, asset, total, fee);