Merge pull request #102 from braydonf/dbpath
Update database directory for bitcore-node.
This commit is contained in:
commit
d997a7093c
|
@ -27,7 +27,7 @@ var fixtureData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var bitcoind = require('../').daemon({
|
var bitcoind = require('../').daemon({
|
||||||
datadir: process.env.BITCOINDJS_DIR || '~/.bitcoin',
|
datadir: process.env.BITCORENODE_DIR || '~/.bitcoin',
|
||||||
network: 'testnet'
|
network: 'testnet'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -304,11 +304,11 @@ Node.prototype._loadDB = function(config) {
|
||||||
var regtest = Networks.get('regtest');
|
var regtest = Networks.get('regtest');
|
||||||
var datadir = config.datadir.replace(/^~/, process.env.HOME);
|
var datadir = config.datadir.replace(/^~/, process.env.HOME);
|
||||||
if (this.network === Networks.livenet) {
|
if (this.network === Networks.livenet) {
|
||||||
config.db.path = datadir + '/bitcoindjs.db';
|
config.db.path = datadir + '/bitcore-node.db';
|
||||||
} else if (this.network === Networks.testnet) {
|
} 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) {
|
} else if (this.network === regtest) {
|
||||||
config.db.path = datadir + '/regtest/bitcoindjs.db';
|
config.db.path = datadir + '/regtest/bitcore-node.db';
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown network: ' + this.network);
|
throw new Error('Unknown network: ' + this.network);
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ describe('Bitcoind Node', function() {
|
||||||
describe('#_loadDB', function() {
|
describe('#_loadDB', function() {
|
||||||
it('should load the db', function() {
|
it('should load the db', function() {
|
||||||
var DB = function(config) {
|
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 = {
|
var config = {
|
||||||
DB: DB,
|
DB: DB,
|
||||||
|
@ -261,7 +261,7 @@ describe('Bitcoind Node', function() {
|
||||||
});
|
});
|
||||||
it('should load the db for testnet', function() {
|
it('should load the db for testnet', function() {
|
||||||
var DB = function(config) {
|
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 = {
|
var config = {
|
||||||
DB: DB,
|
DB: DB,
|
||||||
|
@ -286,7 +286,7 @@ describe('Bitcoind Node', function() {
|
||||||
});
|
});
|
||||||
it('should load the db with regtest', function() {
|
it('should load the db with regtest', function() {
|
||||||
var DB = function(config) {
|
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 = {
|
var config = {
|
||||||
DB: DB,
|
DB: DB,
|
||||||
|
@ -381,7 +381,7 @@ describe('Bitcoind Node', function() {
|
||||||
node._initializeBitcoind();
|
node._initializeBitcoind();
|
||||||
node.bitcoind.emit('ready');
|
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({});
|
var node = new Node({});
|
||||||
node.bitcoind = new EventEmitter();
|
node.bitcoind = new EventEmitter();
|
||||||
node.on('error', function(err) {
|
node.on('error', function(err) {
|
||||||
|
|
Loading…
Reference in New Issue