From 01dcdaecd095e30e75f86d3a9100388a7c8b5518 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Sat, 13 Nov 2021 06:33:51 -0600 Subject: [PATCH] Ensure all txs are logged to DB Not just the ones with the proper memo --- backend/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/app.js b/backend/app.js index 7c41fa0..47356c6 100644 --- a/backend/app.js +++ b/backend/app.js @@ -99,6 +99,11 @@ var blockInterval = setInterval( function() { var re = /.*ZGO::(.*)\sReply-To:\s(z\w+)/; async.each (txs, function(txData, callback) { var memo = hexToString(txData.memo).replace(/\0/g, ''); + txmodel.updateOne({txid: txData.txid}, { confirmations: txData.confirmations, amount:txData.amount, memo: memo}, {new:true, upsert:true}, function(err,docs) { + if (err) { + console.log(err); + } + }); if (re.test(memo)) { //console.log('Processing tx:', memo); var match = re.exec(memo); @@ -114,7 +119,7 @@ var blockInterval = setInterval( function() { console.log(err); } }); - if (txData.confirmations >= 10 ) { + if (txData.confirmations >= 6 ) { usermodel.findOne({address: address, session: session, blocktime: blocktime}).then(function(doc){ if (doc != null) { console.log('Found user');