diff options
| author | Adam Soltys <[email protected]> | 2021-08-30 14:48:26 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-30 16:03:09 -0700 |
| commit | c6dc858ee5491e6c584d94d702438e9b24adbfc7 (patch) | |
| tree | 412344ab540dc81f209a965eaf82e5621a85b4d3 /routes/assets.js | |
| parent | 7d3cc287e862e590c7cc85a8ce99eb2782ff84af (diff) | |
| download | coinos-server-c6dc858ee5491e6c584d94d702438e9b24adbfc7.tar.gz coinos-server-c6dc858ee5491e6c584d94d702438e9b24adbfc7.zip | |
handle conversions for internal payments
Diffstat (limited to 'routes/assets.js')
| -rw-r--r-- | routes/assets.js | 5 |
1 files changed, 3 insertions, 2 deletions
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." |
