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;