wallet: better option parsing for wallet plugin.

This commit is contained in:
Christopher Jeffrey 2017-12-12 12:06:29 -08:00
parent e01a492489
commit 425b8780f7
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 22 additions and 23 deletions

View File

@ -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();

View File

@ -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}
*/