From 3945a45a3b1ce9693b3af33af88a0d7e409c0328 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 21 Oct 2015 10:37:58 -0300 Subject: [PATCH] exclude duplicated TXID in CSV --- src/js/controllers/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 79e44238a..5cd45490c 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -685,6 +685,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r var step = 6; + var unique = {}; function getHistory(skip, cb) { skip = skip || 0; fc.getTxHistory({ @@ -693,7 +694,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r }, function(err, txs) { if (err) return cb(err); if (txs && txs.length > 0) { - allTxs.push(txs); + lodash.each(txs, function(tx) { + if (!unique[tx.txid]){ + allTxs.push(tx); + unique[tx.txid] = 1; + console.log("Got:" + lodash.keys(unique).length + " txs"); + } else { + console.log("Ignoring Duplicate TX:", tx.txid); + } + }); return getHistory(skip + step, cb); } else { return cb(null, lodash.flatten(allTxs));