aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js12
1 files 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) {