aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/createExceptions.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/createExceptions.js')
-rw-r--r--scripts/createExceptions.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/createExceptions.js b/scripts/createExceptions.js
new file mode 100644
index 00000000..bec6ebc6
--- /dev/null
+++ b/scripts/createExceptions.js
@@ -0,0 +1,32 @@
+BitcoinCore = require("bitcoin-core");
+fs = require("fs");
+config = require("./config");
+bc = new BitcoinCore(config.bitcoin);
+l = require("pino")();
+require("./db");
+
+console.log(db.Payment);
+
+(async () => {
+ payments = (
+ await db.Payment.findAll({
+ attributes: ["hash"],
+ })
+ ).map((p) => p.hash);
+ const transactions = await bc.listTransactions("*", 1000);
+ var stream = fs.createWriteStream("exceptions", {
+ flags: "a",
+ emitClose: true,
+ });
+ transactions.map((tx) => {
+ if (!payments.includes(tx.txid)) {
+ l.info("writing", tx.txid);
+ stream.write(tx.txid + "\n");
+ }
+ });
+ stream.end();
+ stream.on("close", () => {
+ l.info("done");
+ process.exit();
+ });
+})();