diff options
Diffstat (limited to 'routes/send.js')
| -rw-r--r-- | routes/send.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routes/send.js b/routes/send.js index 002ce8d8..5d46f4de 100644 --- a/routes/send.js +++ b/routes/send.js @@ -30,7 +30,7 @@ export default async (req, res, next) => { try { await db.transaction(async transaction => { let account; - if (user.account.asset === asset) { + if (user.account.asset === asset && !user.account.pubkey) { account = await db.Account.findOne({ where: { id: user.account.id, @@ -51,6 +51,8 @@ export default async (req, res, next) => { }); } + if (!account) throw new Error("Account not found"); + if (account.balance < amount) { throw new Error("Insufficient funds"); } |
