wallet: better option parsing for wallet plugin.
This commit is contained in:
parent
e01a492489
commit
425b8780f7
@ -33,7 +33,8 @@ class Plugin extends EventEmitter {
|
|||||||
constructor(node) {
|
constructor(node) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
const config = node.config;
|
this.config = node.config.filter('wallet');
|
||||||
|
this.config.open('wallet.conf');
|
||||||
|
|
||||||
this.network = node.network;
|
this.network = node.network;
|
||||||
this.logger = node.logger;
|
this.logger = node.logger;
|
||||||
@ -41,34 +42,34 @@ class Plugin extends EventEmitter {
|
|||||||
this.client = new NodeClient(node);
|
this.client = new NodeClient(node);
|
||||||
|
|
||||||
this.wdb = new WalletDB({
|
this.wdb = new WalletDB({
|
||||||
network: node.network,
|
network: this.network,
|
||||||
logger: node.logger,
|
logger: this.logger,
|
||||||
workers: node.workers,
|
workers: this.workers,
|
||||||
client: this.client,
|
client: this.client,
|
||||||
prefix: config.prefix,
|
prefix: this.config.prefix,
|
||||||
memory: config.bool(['wallet-memory', 'memory']),
|
memory: this.config.bool('memory', node.memory),
|
||||||
maxFiles: config.uint('wallet-max-files'),
|
maxFiles: this.config.uint('max-files'),
|
||||||
cacheSize: config.mb('wallet-cache-size'),
|
cacheSize: this.config.mb('cache-size'),
|
||||||
witness: config.bool('wallet-witness'),
|
witness: this.config.bool('witness'),
|
||||||
checkpoints: config.bool('wallet-checkpoints'),
|
checkpoints: this.config.bool('checkpoints'),
|
||||||
wipeNoReally: config.bool('wallet-wipe-no-really'),
|
wipeNoReally: this.config.bool('wipe-no-really'),
|
||||||
spv: node.spv
|
spv: node.spv
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rpc = new RPC(this);
|
this.rpc = new RPC(this);
|
||||||
|
|
||||||
this.http = new HTTP({
|
this.http = new HTTP({
|
||||||
network: node.network,
|
network: this.network,
|
||||||
logger: node.logger,
|
logger: this.logger,
|
||||||
node: this,
|
node: this,
|
||||||
ssl: config.bool(['wallet-ssl', 'ssl']),
|
ssl: this.config.bool('ssl'),
|
||||||
keyFile: config.path(['wallet-ssl-key', 'ssl-key']),
|
keyFile: this.config.path('ssl-key'),
|
||||||
certFile: config.path(['wallet-ssl-cert', 'ssl-cert']),
|
certFile: this.config.path('ssl-cert'),
|
||||||
host: config.str(['wallet-http-host', 'http-host']),
|
host: this.config.str('http-host'),
|
||||||
port: config.uint(['wallet-http-port', 'http-port']),
|
port: this.config.uint('http-port'),
|
||||||
apiKey: config.str(['wallet-api-key', 'api-key']),
|
apiKey: this.config.str('api-key', node.config.str('api-key')),
|
||||||
walletAuth: config.bool('wallet-auth'),
|
walletAuth: this.config.bool('wallet-auth'),
|
||||||
noAuth: config.bool(['wallet-no-auth', 'no-auth'])
|
noAuth: this.config.bool('no-auth')
|
||||||
});
|
});
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
|
|||||||
@ -89,7 +89,6 @@ class WalletNode extends Node {
|
|||||||
/**
|
/**
|
||||||
* Open the node and all its child objects,
|
* Open the node and all its child objects,
|
||||||
* wait for the database to load.
|
* wait for the database to load.
|
||||||
* @alias WalletNode#open
|
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -112,7 +111,6 @@ class WalletNode extends Node {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the node, wait for the database to close.
|
* Close the node, wait for the database to close.
|
||||||
* @alias WalletNode#close
|
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user