txdb: misc.

This commit is contained in:
Christopher Jeffrey 2016-10-18 05:36:11 -07:00
parent 8368265c71
commit aa0f73b27d
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1246,13 +1246,11 @@ TXDB.prototype.__remove = co(function* remove(tx, info) {
if (!path)
continue;
coin = Coin.fromTX(tx, i);
this.pending.coin--;
this.pending.unconfirmed -= coin.value;
this.pending.unconfirmed -= output.value;
if (tx.height !== -1)
this.pending.confirmed -= coin.value;
this.pending.confirmed -= output.value;
this.del(layout.c(hash, i));
this.del(layout.C(path.account, hash, i));
@ -1893,7 +1891,7 @@ TXDB.prototype.getCoins = co(function* getCoins(account, all) {
// Slow case
if (account != null)
return this.getAccountCoins(account);
return this.getAccountCoins(account, all);
// Fast case
coins = yield this.range({
@ -1931,7 +1929,7 @@ TXDB.prototype.getCoins = co(function* getCoins(account, all) {
* @returns {Promise} - Returns {@link Coin}[].
*/
TXDB.prototype.getAccountCoins = co(function* getCoins(account, all) {
TXDB.prototype.getAccountCoins = co(function* getAccountCoins(account, all) {
var prevout = yield this.getOutpoints(account);
var coins = [];
var i, op, coin;
@ -2226,7 +2224,7 @@ TXDB.prototype.getBalance = co(function* getBalance(account) {
*/
TXDB.prototype.getWalletBalance = co(function* getWalletBalance() {
var coins = yield this.getCoins(true);
var coins = yield this.getCoins(null, true);
var balance = new Balance(this.wallet.wid, this.wallet.id, -1);
var i, coin;