wallet: remove getLastTime.
This commit is contained in:
parent
06bb874573
commit
740e8012a2
@ -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.
|
* Get unconfirmed transactions.
|
||||||
* @param {Number?} account
|
* @param {Number?} account
|
||||||
|
|||||||
@ -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).
|
* Get a range of transactions between two timestamps (accesses db).
|
||||||
* @param {(String|Number)?} account
|
* @param {(String|Number)?} account
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user