node: require walletdb by default for now.

This commit is contained in:
Christopher Jeffrey 2017-03-14 06:22:43 -07:00
parent 74b21b78c5
commit 1d6bd6dbe4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 20 additions and 4 deletions

View File

@ -5,6 +5,7 @@
process.title = 'bcoin';
var bcoin = require('../');
var plugin = require('../lib/wallet/plugin');
var co = bcoin.co;
var node;
@ -21,6 +22,10 @@ node = new bcoin.fullnode({
loader: require
});
// Temporary hack
if (!node.has('walletdb'))
node.use(plugin);
node.on('error', function(err) {
;
});

View File

@ -6,6 +6,7 @@ process.title = 'bcoin';
var assert = require('assert');
var bcoin = require('../');
var plugin = require('../lib/wallet/plugin');
var util = bcoin.util;
var co = bcoin.co;
var node;
@ -23,6 +24,10 @@ node = bcoin.spvnode({
loader: require
});
// Temporary hack
if (!node.has('walletdb'))
node.use(plugin);
node.on('error', function(err) {
;
});

View File

@ -314,6 +314,16 @@ Node.prototype.use = function use(plugin) {
return instance;
};
/**
* Test whether a plugin is available.
* @param {String} name
* @returns {Boolean}
*/
Node.prototype.has = function has(name) {
return this.plugins[name] != null;
};
/**
* Require a plugin.
* @param {String} name
@ -371,10 +381,6 @@ Node.prototype.loadPlugins = function loadPlugins() {
assert(typeof name === 'string',
'Plugin name must be a string.');
// Temporary until we separate walletdb out.
if (name === 'walletdb')
name = __dirname + '/../wallet/plugin';
plugin = loader(name);
this.use(plugin);