diff options
| author | Adam Soltys <[email protected]> | 2022-09-13 15:24:16 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-13 15:24:16 -0700 |
| commit | ff7514b07057ac5369a1c857f546ac0058fa310b (patch) | |
| tree | 52ff78d25fe1c8f928f374b3513104507e9c7531 /routes/send.js | |
| parent | efa9cc6aa10751ffbb930333666bfe2720cb798c (diff) | |
| parent | 9f6595065f3c2433b2f542fd12ff976ff02d17e3 (diff) | |
| download | coinos-server-ff7514b07057ac5369a1c857f546ac0058fa310b.tar.gz coinos-server-ff7514b07057ac5369a1c857f546ac0058fa310b.zip | |
Merge remote-tracking branch 'origin/prod'
Diffstat (limited to 'routes/send.js')
| -rw-r--r-- | routes/send.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routes/send.js b/routes/send.js index ec6f924e..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"); } @@ -180,7 +182,7 @@ export default async (req, res, next) => { if (invoice) { params.invoice_id = invoice.id; - let c = convert[invoice.text]; + let c = store.convert[invoice.text]; if (c) { l( "internal payment detected for conversion", |
