Ensure all txs are logged to DB

Not just the ones with the proper memo
This commit is contained in:
Rene Vergara 2021-11-13 06:33:51 -06:00
parent 1336cc2009
commit 01dcdaecd0
1 changed files with 6 additions and 1 deletions

View File

@ -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');