aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sync.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sync.js')
-rw-r--r--lib/sync.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/sync.js b/lib/sync.js
index 1a98c121..6fcf8a10 100644
--- a/lib/sync.js
+++ b/lib/sync.js
@@ -4,12 +4,13 @@ import { differenceInDays } from "date-fns";
import fs from "fs";
import read from "../lib/read.js";
import { Op } from "@sequelize/core";
+import { addresses, exceptions } from "./store.js";
const init = async () => {
try {
read(fs.createReadStream("exceptions"), data => exceptions.push(data));
} catch (e) {
- l.warn("couldn't read exceptions file", e.message);
+ warn("couldn't read exceptions file", e.message);
}
try {
@@ -132,11 +133,11 @@ const sync = async () => {
await account.increment({ balance: amount });
- l.info("lightning missing from account", account.id, amount);
+ l("lightning missing from account", account.id, amount);
}
}
} catch (e) {
- l.error(
+ err(
"problem syncing lightning payment",
JSON.stringify(missed[i]),
e.message,
@@ -194,9 +195,9 @@ const sync = async () => {
emit(p.user.username, "account", p.account);
emit(p.user.username, "payment", p);
- l.info("unconfirmed tx", p.user_id, p.hash, p.address);
+ l("unconfirmed tx", p.user_id, p.hash, p.address);
} catch (e) {
- l.error("problem confirming payment", p, e.message, e.stack);
+ err("problem confirming payment", p, e.message, e.stack);
}
}
@@ -214,7 +215,7 @@ const sync = async () => {
});
if (unaccounted.length)
- l.warn(
+ warn(
"wallet transactions missing from database",
unaccounted.map(tx => tx.txid)
);
@@ -261,7 +262,7 @@ const sync = async () => {
user_id
} = invoices[i];
- l.info("unaccounted", address);
+ l("unaccounted", address);
let pending = unaccounted.filter(
tx => tx.address === address || tx.address === unconfidential
@@ -274,7 +275,7 @@ const sync = async () => {
try {
await db.transaction(async transaction => {
- l.info("found pending transaction", user.username, amount, hash);
+ l("found pending transaction", user.username, amount, hash);
payments.push(hash);
let p = await db.Payment.create(
{
@@ -300,7 +301,7 @@ const sync = async () => {
emit(user.username, "payment", p);
});
} catch (e) {
- l.error(
+ err(
"problem updating pending transaction",
hash,
e.message,
@@ -310,7 +311,7 @@ const sync = async () => {
}
}
} catch (e) {
- l.error("sync check failed", e.message, e.stack);
+ err("sync check failed", e.message, e.stack);
}
setTimeout(sync, 300000);