Skip to content

Commit

Permalink
fix: Fix callback name
Browse files Browse the repository at this point in the history
  • Loading branch information
matiu committed Dec 12, 2018
1 parent 72bf2bb commit 44a45de
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
},
Expand Down Expand Up @@ -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);
})
Expand Down Expand Up @@ -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.

}
);
});
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}),
Expand Down

0 comments on commit 44a45de

Please sign in to comment.