From 425b8780f70a9e3d421378d08796e55eb4f4c582 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 12 Dec 2017 12:06:29 -0800 Subject: [PATCH] wallet: better option parsing for wallet plugin. --- lib/wallet/plugin.js | 43 ++++++++++++++++++++++--------------------- lib/wallet/server.js | 2 -- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/wallet/plugin.js b/lib/wallet/plugin.js index f19d3573..0f957360 100644 --- a/lib/wallet/plugin.js +++ b/lib/wallet/plugin.js @@ -33,7 +33,8 @@ class Plugin extends EventEmitter { constructor(node) { super(); - const config = node.config; + this.config = node.config.filter('wallet'); + this.config.open('wallet.conf'); this.network = node.network; this.logger = node.logger; @@ -41,34 +42,34 @@ class Plugin extends EventEmitter { this.client = new NodeClient(node); this.wdb = new WalletDB({ - network: node.network, - logger: node.logger, - workers: node.workers, + network: this.network, + logger: this.logger, + workers: this.workers, client: this.client, - prefix: config.prefix, - memory: config.bool(['wallet-memory', 'memory']), - maxFiles: config.uint('wallet-max-files'), - cacheSize: config.mb('wallet-cache-size'), - witness: config.bool('wallet-witness'), - checkpoints: config.bool('wallet-checkpoints'), - wipeNoReally: config.bool('wallet-wipe-no-really'), + prefix: this.config.prefix, + memory: this.config.bool('memory', node.memory), + maxFiles: this.config.uint('max-files'), + cacheSize: this.config.mb('cache-size'), + witness: this.config.bool('witness'), + checkpoints: this.config.bool('checkpoints'), + wipeNoReally: this.config.bool('wipe-no-really'), spv: node.spv }); this.rpc = new RPC(this); this.http = new HTTP({ - network: node.network, - logger: node.logger, + network: this.network, + logger: this.logger, node: this, - ssl: config.bool(['wallet-ssl', 'ssl']), - keyFile: config.path(['wallet-ssl-key', 'ssl-key']), - certFile: config.path(['wallet-ssl-cert', 'ssl-cert']), - host: config.str(['wallet-http-host', 'http-host']), - port: config.uint(['wallet-http-port', 'http-port']), - apiKey: config.str(['wallet-api-key', 'api-key']), - walletAuth: config.bool('wallet-auth'), - noAuth: config.bool(['wallet-no-auth', 'no-auth']) + ssl: this.config.bool('ssl'), + keyFile: this.config.path('ssl-key'), + certFile: this.config.path('ssl-cert'), + host: this.config.str('http-host'), + port: this.config.uint('http-port'), + apiKey: this.config.str('api-key', node.config.str('api-key')), + walletAuth: this.config.bool('wallet-auth'), + noAuth: this.config.bool('no-auth') }); this.init(); diff --git a/lib/wallet/server.js b/lib/wallet/server.js index 7c982eb6..528a1bb1 100644 --- a/lib/wallet/server.js +++ b/lib/wallet/server.js @@ -89,7 +89,6 @@ class WalletNode extends Node { /** * Open the node and all its child objects, * wait for the database to load. - * @alias WalletNode#open * @returns {Promise} */ @@ -112,7 +111,6 @@ class WalletNode extends Node { /** * Close the node, wait for the database to close. - * @alias WalletNode#close * @returns {Promise} */