diff --git a/lib/http/rpc.js b/lib/http/rpc.js index 436fa316..9ae5db0f 100644 --- a/lib/http/rpc.js +++ b/lib/http/rpc.js @@ -202,7 +202,11 @@ RPC.prototype.stop = async function stop(args, help) { if (help || args.length !== 0) throw new RPCError(errs.MISC_ERROR, 'stop'); - this.node.close().catch(() => {}); + this.node.close().catch((err) => { + setImmediate(() => { + throw err; + }); + }); return 'Stopping.'; }; diff --git a/lib/node/fullnode.js b/lib/node/fullnode.js index d66cd5bb..1e236972 100644 --- a/lib/node/fullnode.js +++ b/lib/node/fullnode.js @@ -402,9 +402,8 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) { let mempool = this.mempool.getCoinsByAddress(addrs); let chain = await this.chain.db.getCoinsByAddress(addrs); let out = []; - let coin; - for (coin of chain) { + for (let coin of chain) { let spent = this.mempool.isSpent(coin.hash, coin.index); if (spent) @@ -413,7 +412,7 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) { out.push(coin); } - for (coin of mempool) + for (let coin of mempool) out.push(coin); return out;