From 44a45def7a3c483b0ca9f9b55bc0578028c753e9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 26 Sep 2018 16:40:22 -0300 Subject: [PATCH] fix: Fix callback name --- lib/server.js | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/server.js b/lib/server.js index 18a8e3b1f84..56326b242eb 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1398,7 +1398,7 @@ console.log('[server.js.1344:lockedInputs:]',lockedInputs); //TODO allUtxos = _.reject(allUtxos, { spent: true }); -console.log('[server.js.1371:allUtxos:]',allUtxos); //TODO +console.log('[server.js.1371:allUtxos:]',allUtxos.length); //TODO return next(); }); }, @@ -2661,8 +2661,6 @@ WalletService.prototype._checkTxInBlockchain = function(txp, cb) { var bc = this._getBlockchainExplorer(txp.coin, txp.network); if (!bc) return cb(new Error('Could not get blockchain explorer instance')); bc.getTransaction(txp.txid, function(err, tx) { -console.log('[server.js.2639:tx:]',tx); //TODO -console.log('[server.js.2639:err:]',err); //TODO if (err) return cb(err); return cb(null, !!tx); }) @@ -3415,10 +3413,25 @@ WalletService.prototype.updateTxHistoryCacheV8 = function(bc, wallet, sinceId, b }); }, (err) => { - // TODO - all = self._normalizeV8TxHistory(all, bcHeight); if (err) return cb(err); - return cb(null, all); + + all = self._normalizeV8TxHistory(all, bcHeight); + + // We have now from 'sinceId` to end in `all`. + // Store hard confirmed TXs + + var txsToCache = _.filter(txs, function(i) { + return i.confirmations >= Defaults.CONFIRMATIONS_TO_START_CACHING; + }); +// if (!txsToCache.length) { + return cb(null, all); + // } + + // + // var fwdIndex = totalItems - to; + // if (fwdIndex < 0) fwdIndex = 0; + //self.storage.storeTxHistoryCache(self. + } ); }); @@ -3479,7 +3492,7 @@ console.log('######### [#server.js.3446:txs:] FINAL ',txs, from, to); //TODO }); }; -WalletService.prototype.getTxHistoryOld = function (bc, wallet, opts, from, to, icb) { +WalletService.prototype.getTxHistoryOld = function (bc, wallet, opts, from, to, cb) { var self = this; var txs, fromCache, totalItems, useCache, addressStrs, bcHeight; @@ -3559,11 +3572,11 @@ WalletService.prototype.getTxHistoryOld = function (bc, wallet, opts, from, to, next(); }, ], function(err) { - if (err) return icb(err); + if (err) return cb(err); var indexedAddresses = _.indexBy(addresses, 'address'); - return icb(null, { + return cb(null, { items: _.map(txs, (tx) => { return WalletService._getResultTx(wallet, indexedAddresses, tx, opts); }),