From 740e8012a2e3f4e62a2f31e8aad65515fce82668 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 26 Aug 2016 05:08:07 -0700 Subject: [PATCH] wallet: remove getLastTime. --- lib/wallet/txdb.js | 35 ----------------------------------- lib/wallet/wallet.js | 14 -------------- 2 files changed, 49 deletions(-) diff --git a/lib/wallet/txdb.js b/lib/wallet/txdb.js index a9bf688d..886a3114 100644 --- a/lib/wallet/txdb.js +++ b/lib/wallet/txdb.js @@ -1691,41 +1691,6 @@ TXDB.prototype.getAccountHistory = function getAccountHistory(account, callback) }); }; -/** - * Get last active timestamp and height. - * @param {Number?} account - * @param {Function} callback - Returns [Error, Number(ts), Number(height)]. - */ - -TXDB.prototype.getLastTime = function getLastTime(account, callback) { - var i, tx, lastTs, lastHeight; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - this.getHistory(account, function(err, txs) { - if (err) - return callback(err); - - lastTs = 0; - lastHeight = -1; - - for (i = 0; i < txs.length; i++) { - tx = txs[i]; - - if (tx.ts > lastTs) - lastTs = tx.ts; - - if (tx.height > lastHeight) - lastHeight = tx.height; - } - - callback(null, lastTs, lastHeight); - }); -}; - /** * Get unconfirmed transactions. * @param {Number?} account diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js index ff99c86d..e740690d 100644 --- a/lib/wallet/wallet.js +++ b/lib/wallet/wallet.js @@ -1624,20 +1624,6 @@ Wallet.prototype.getBalance = function getBalance(account, callback) { }); }; -/** - * Get last timestamp and height this wallet was active - * at (accesses db). Useful for resetting the chain - * to a certain height when in SPV mode. - * @param {(String|Number)?} account - * @param {Function} callback - Returns [Error, Number(ts), Number(height)]. - */ - -Wallet.prototype.getLastTime = function getLastTime(account, callback) { - this._getIndex(account, callback, function(account, callback) { - this.tx.getLastTime(account, callback); - }); -}; - /** * Get a range of transactions between two timestamps (accesses db). * @param {(String|Number)?} account