diff --git a/lib/wallet/txdb.js b/lib/wallet/txdb.js index fb440892..1ff036d0 100644 --- a/lib/wallet/txdb.js +++ b/lib/wallet/txdb.js @@ -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;