aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sync.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-03-25 23:47:57 -0400
committerAdam Soltys <[email protected]>2022-03-25 23:48:06 -0400
commit5576f07a5a29bc8f2cb0695f5e12b4603b2771f9 (patch)
treeeafe9213860a969a1378d13262a2d55b1c5fec53 /lib/sync.js
parent2cc2510c078ed0acae1f3de1e9f1ec8f38776263 (diff)
downloadcoinos-server-5576f07a5a29bc8f2cb0695f5e12b4603b2771f9.tar.gz
coinos-server-5576f07a5a29bc8f2cb0695f5e12b4603b2771f9.zip
wait for 2 confs before reporting unconfirmed txns
Diffstat (limited to 'lib/sync.js')
-rw-r--r--lib/sync.js9
1 files changed, 6 insertions, 3 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",