rpc: fix wallet and account balances.

This commit is contained in:
Christopher Jeffrey 2016-10-21 21:48:34 -07:00
parent e6f869ce09
commit 0ead568225
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -323,7 +323,7 @@ RPC.prototype.getinfo = co(function* getinfo(args) {
version: constants.USER_VERSION, version: constants.USER_VERSION,
protocolversion: constants.VERSION, protocolversion: constants.VERSION,
walletversion: 0, walletversion: 0,
balance: +utils.btc(balance.total), balance: +utils.btc(balance.unconfirmed),
blocks: this.chain.height, blocks: this.chain.height,
timeoffset: time.offset, timeoffset: time.offset,
connections: this.pool.peers.all.length, connections: this.pool.peers.all.length,
@ -2913,7 +2913,7 @@ RPC.prototype.getbalance = co(function* getbalance(args) {
if (minconf) if (minconf)
value = balance.confirmed; value = balance.confirmed;
else else
value = balance.total; value = balance.unconfirmed;
return +utils.btc(value); return +utils.btc(value);
}); });
@ -3173,7 +3173,7 @@ RPC.prototype.getwalletinfo = co(function* getwalletinfo(args) {
return { return {
walletid: this.wallet.id, walletid: this.wallet.id,
walletversion: 0, walletversion: 0,
balance: +utils.btc(balance.total), balance: +utils.btc(balance.unconfirmed),
unconfirmed_balance: +utils.btc(balance.unconfirmed), unconfirmed_balance: +utils.btc(balance.unconfirmed),
txcount: this.wallet.state.tx, txcount: this.wallet.state.tx,
keypoololdest: 0, keypoololdest: 0,
@ -3326,7 +3326,7 @@ RPC.prototype.listaccounts = co(function* listaccounts(args) {
for (i = 0; i < accounts.length; i++) { for (i = 0; i < accounts.length; i++) {
account = accounts[i]; account = accounts[i];
balance = yield this.wallet.getBalance(account); balance = yield this.wallet.getBalance(account);
map[account] = +utils.btc(balance.total); map[account] = +utils.btc(balance.unconfirmed);
} }
return map; return map;