diff options
| -rw-r--r-- | lib/sync.js | 9 | ||||
| -rw-r--r-- | routes/users.js | 4 |
2 files changed, 8 insertions, 5 deletions
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(); } }) |
