node/rpc: throw errors on shutdown. minor changes.
This commit is contained in:
parent
7eefb773be
commit
32c93af2c4
@ -202,7 +202,11 @@ RPC.prototype.stop = async function stop(args, help) {
|
|||||||
if (help || args.length !== 0)
|
if (help || args.length !== 0)
|
||||||
throw new RPCError(errs.MISC_ERROR, 'stop');
|
throw new RPCError(errs.MISC_ERROR, 'stop');
|
||||||
|
|
||||||
this.node.close().catch(() => {});
|
this.node.close().catch((err) => {
|
||||||
|
setImmediate(() => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return 'Stopping.';
|
return 'Stopping.';
|
||||||
};
|
};
|
||||||
|
|||||||
@ -402,9 +402,8 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) {
|
|||||||
let mempool = this.mempool.getCoinsByAddress(addrs);
|
let mempool = this.mempool.getCoinsByAddress(addrs);
|
||||||
let chain = await this.chain.db.getCoinsByAddress(addrs);
|
let chain = await this.chain.db.getCoinsByAddress(addrs);
|
||||||
let out = [];
|
let out = [];
|
||||||
let coin;
|
|
||||||
|
|
||||||
for (coin of chain) {
|
for (let coin of chain) {
|
||||||
let spent = this.mempool.isSpent(coin.hash, coin.index);
|
let spent = this.mempool.isSpent(coin.hash, coin.index);
|
||||||
|
|
||||||
if (spent)
|
if (spent)
|
||||||
@ -413,7 +412,7 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) {
|
|||||||
out.push(coin);
|
out.push(coin);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (coin of mempool)
|
for (let coin of mempool)
|
||||||
out.push(coin);
|
out.push(coin);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user