Merge pull request #102 from braydonf/dbpath

Update database directory for bitcore-node.
This commit is contained in:
Chris Kleeschulte 2015-08-04 16:42:14 -04:00
commit d997a7093c
3 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ var fixtureData = {
};
var bitcoind = require('../').daemon({
datadir: process.env.BITCOINDJS_DIR || '~/.bitcoin',
datadir: process.env.BITCORENODE_DIR || '~/.bitcoin',
network: 'testnet'
});

View File

@ -304,11 +304,11 @@ Node.prototype._loadDB = function(config) {
var regtest = Networks.get('regtest');
var datadir = config.datadir.replace(/^~/, process.env.HOME);
if (this.network === Networks.livenet) {
config.db.path = datadir + '/bitcoindjs.db';
config.db.path = datadir + '/bitcore-node.db';
} else if (this.network === Networks.testnet) {
config.db.path = datadir + '/testnet3/bitcoindjs.db';
config.db.path = datadir + '/testnet3/bitcore-node.db';
} else if (this.network === regtest) {
config.db.path = datadir + '/regtest/bitcoindjs.db';
config.db.path = datadir + '/regtest/bitcore-node.db';
} else {
throw new Error('Unknown network: ' + this.network);
}

View File

@ -247,7 +247,7 @@ describe('Bitcoind Node', function() {
describe('#_loadDB', function() {
it('should load the db', function() {
var DB = function(config) {
config.path.should.equal(process.env.HOME + '/.bitcoin/bitcoindjs.db');
config.path.should.equal(process.env.HOME + '/.bitcoin/bitcore-node.db');
};
var config = {
DB: DB,
@ -261,7 +261,7 @@ describe('Bitcoind Node', function() {
});
it('should load the db for testnet', function() {
var DB = function(config) {
config.path.should.equal(process.env.HOME + '/.bitcoin/testnet3/bitcoindjs.db');
config.path.should.equal(process.env.HOME + '/.bitcoin/testnet3/bitcore-node.db');
};
var config = {
DB: DB,
@ -286,7 +286,7 @@ describe('Bitcoind Node', function() {
});
it('should load the db with regtest', function() {
var DB = function(config) {
config.path.should.equal(process.env.HOME + '/.bitcoin/regtest/bitcoindjs.db');
config.path.should.equal(process.env.HOME + '/.bitcoin/regtest/bitcore-node.db');
};
var config = {
DB: DB,
@ -381,7 +381,7 @@ describe('Bitcoind Node', function() {
node._initializeBitcoind();
node.bitcoind.emit('ready');
});
it('will call emit an error from bitcoind.js', function(done) {
it('will call emit an error from libbitcoind', function(done) {
var node = new Node({});
node.bitcoind = new EventEmitter();
node.on('error', function(err) {