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