diff options
| author | Adam Soltys <[email protected]> | 2020-07-29 10:04:57 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-07-29 10:19:22 -0700 |
| commit | ffee4c7051982f3677d6717d24e7b357a89802eb (patch) | |
| tree | bda672176e7fc4f585df483c2a2568c3bd573037 /createExceptions.js | |
| parent | d22869941ec704edd17d1d05038e6139681f97cf (diff) | |
| download | coinos-server-ffee4c7051982f3677d6717d24e7b357a89802eb.tar.gz coinos-server-ffee4c7051982f3677d6717d24e7b357a89802eb.zip | |
warn about missing and unconfirmed transactions
Diffstat (limited to 'createExceptions.js')
| -rw-r--r-- | createExceptions.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/createExceptions.js b/createExceptions.js new file mode 100644 index 00000000..bec6ebc6 --- /dev/null +++ b/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(); + }); +})(); |
