From 9b5ed5e197c6c08cd7cce7e2d2c7d37c835f1aec Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Apr 2018 05:47:41 +0000 Subject: use bid price --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index cce5e4d1..c009343b 100644 --- a/index.js +++ b/index.js @@ -240,7 +240,11 @@ const l = console.log if (msg.startsWith('Multiple')) { busypeers.push(peer) peer = lna.channelpeers.find(p => !busypeers.includes(p)) - return openchannel(peer, amount) + if (peer) { + return openchannel(peer, amount) + } else { + return res.status(500).send('All peers are busy, couldn\'t open a channel, wait a few blocks and try again') + } } if (msg.startsWith('not enough')) { @@ -303,7 +307,7 @@ const l = console.log amount: -total, user_id: req.user.id, hash, - rate: app.get('rates').ask, + rate: app.get('rates').bid, currency: 'CAD', }) @@ -355,7 +359,7 @@ const l = console.log amount: -total, user_id: req.user.id, hash: txid, - rate: app.get('rates').ask, + rate: app.get('rates').bid, currency: 'CAD', }) @@ -418,7 +422,7 @@ const l = console.log } }) - if (!user) throw new Error('User not found') + if (!user) return res.status(401).end() let result = await bcrypt.compare(req.body.password, user.password) if (result) { -- cgit v1.2.3