From c6dc858ee5491e6c584d94d702438e9b24adbfc7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 30 Aug 2021 14:48:26 -0700 Subject: handle conversions for internal payments --- routes/assets.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'routes/assets.js') diff --git a/routes/assets.js b/routes/assets.js index d163e8e6..72d4c329 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -333,10 +333,12 @@ app.post( return res.status(500).send("Faucet feature temporarily disabled"); const { user } = req; - const { asset, amount } = req.body; + let { asset, amount } = req.body; amount = parseInt(amount); try { + if (amount <= 0) throw new Error("Amount to load cannot be negative"); + await db.transaction(async transaction => { let account = await getAccount( config.liquid.btcasset, @@ -344,7 +346,6 @@ app.post( transaction ); - if (amount < 0) throw new Error("Amount to load cannot be negative"); if (account.asset !== config.liquid.btcasset) throw new Error( "Faucet has to be funded with bitcoin. Try sending from another wallet." -- cgit v1.2.3