rpc: minor.

This commit is contained in:
Christopher Jeffrey 2016-12-11 08:22:30 -08:00
parent fc6798d3f0
commit ed4fb0f92c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -3595,28 +3595,26 @@ RPC.prototype._toListTX = co(function* _toListTX(wtx) {
RPC.prototype.listtransactions = co(function* listtransactions(args) { RPC.prototype.listtransactions = co(function* listtransactions(args) {
var wallet = this.wallet; var wallet = this.wallet;
var i, account, count, txs, wtx, json; var account = null;
var count = 10;
var i, txs, wtx, json;
if (args.help || args.length > 4) { if (args.help || args.length > 4) {
throw new RPCError( throw new RPCError(
'listtransactions ( "account" count from includeWatchonly)'); 'listtransactions ( "account" count from includeWatchonly)');
} }
account = null;
if (args.length > 0) { if (args.length > 0) {
account = toString(args[0]); account = toString(args[0]);
if (!account) if (!account)
account = 'default'; account = 'default';
} }
count = 10; if (args.length > 1) {
if (args.length > 1)
count = toNumber(args[1], 10); count = toNumber(args[1], 10);
if (count < 0)
if (count < 0) count = 10;
count = 10; }
txs = yield wallet.getHistory(); txs = yield wallet.getHistory();
@ -3674,10 +3672,7 @@ RPC.prototype.listunspent = co(function* listunspent(args) {
for (i = 0; i < coins.length; i++ ) { for (i = 0; i < coins.length; i++ ) {
coin = coins[i]; coin = coins[i];
depth = coin.getDepth(this.chain.height);
depth = coin.height !== -1
? this.chain.height - coin.height + 1
: 0;
if (!(depth >= minDepth && depth <= maxDepth)) if (!(depth >= minDepth && depth <= maxDepth))
continue; continue;