From 2cc2510c078ed0acae1f3de1e9f1ec8f38776263 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 11 Mar 2022 01:19:34 -0500 Subject: upgrade pm2 --- routes/send.js | 1 + 1 file changed, 1 insertion(+) (limited to 'routes') diff --git a/routes/send.js b/routes/send.js index e44d3224..5f1151c5 100644 --- a/routes/send.js +++ b/routes/send.js @@ -208,6 +208,7 @@ module.exports = ah(async (req, res, next) => { res.send(payment); }); } catch (e) { + console.log(e); l.error("problem sending internal payment", user.username, e.message); return res.status(500).send(e.message); } -- cgit v1.2.3 From 5576f07a5a29bc8f2cb0695f5e12b4603b2771f9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 25 Mar 2022 23:47:57 -0400 Subject: wait for 2 confs before reporting unconfirmed txns --- lib/sync.js | 9 ++++++--- routes/users.js | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'routes') diff --git a/lib/sync.js b/lib/sync.js index dda83eab..10e857b3 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -173,12 +173,13 @@ const sync = async () => { missed = transactions.filter( tx => tx.category === "receive" && - tx.confirmations > 0 && + tx.confirmations > 2 && hashes.includes(tx.txid) ); for (let i = 0; i < missed.length; i++) { let p = unconfirmed.find(p => p.hash === missed[i].txid); + /* p.confirmed = 1; await db.transaction(async transaction => { @@ -190,8 +191,9 @@ const sync = async () => { emit(p.user.username, "account", p.account); emit(p.user.username, "payment", p); + */ - l.info("confirmed tx", p.user_id, p.hash, p.address); + l.info("unconfirmed tx", p.user_id, p.hash, p.address); } unaccounted = []; @@ -286,10 +288,11 @@ const sync = async () => { } catch (e) { l.error("sync check failed", e.message, e.stack); } + + setTimeout(sync, 300000); }; setTimeout(sync, 5000); -setInterval(sync, 300000); app.get( "/conversions", diff --git a/routes/users.js b/routes/users.js index 403c4646..549de828 100644 --- a/routes/users.js +++ b/routes/users.js @@ -358,7 +358,7 @@ app.post( user = pick(user, ...whitelist); res.send({ user, token }); } catch (e) { - l.error("login error", e.message); + l.error("login error", e.message, req.connection.remoteAddress); res.status(401).end(); } }) @@ -420,7 +420,7 @@ app.post( user = pick(user, ...whitelist); res.send({ user, token }); } catch (e) { - l.error("login error", e.message); + l.error("login error", e.message, req.connection.remoteAddress); res.status(401).end(); } }) -- cgit v1.2.3