From ed4fb0f92c1b647e924ca2f20f258ce1315c9595 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 11 Dec 2016 08:22:30 -0800 Subject: [PATCH] rpc: minor. --- lib/http/rpc.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/http/rpc.js b/lib/http/rpc.js index 4e19767b..483616ee 100644 --- a/lib/http/rpc.js +++ b/lib/http/rpc.js @@ -3595,28 +3595,26 @@ RPC.prototype._toListTX = co(function* _toListTX(wtx) { RPC.prototype.listtransactions = co(function* listtransactions(args) { 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) { throw new RPCError( 'listtransactions ( "account" count from includeWatchonly)'); } - account = null; - if (args.length > 0) { account = toString(args[0]); if (!account) account = 'default'; } - count = 10; - - if (args.length > 1) + if (args.length > 1) { count = toNumber(args[1], 10); - - if (count < 0) - count = 10; + if (count < 0) + count = 10; + } txs = yield wallet.getHistory(); @@ -3674,10 +3672,7 @@ RPC.prototype.listunspent = co(function* listunspent(args) { for (i = 0; i < coins.length; i++ ) { coin = coins[i]; - - depth = coin.height !== -1 - ? this.chain.height - coin.height + 1 - : 0; + depth = coin.getDepth(this.chain.height); if (!(depth >= minDepth && depth <= maxDepth)) continue;