blob: 26baeb7e1948d1c6b15d7e2113e33d4437bccc67 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
BitcoinCore = require("@asoltys/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();
});
})();
|