default datadir=.bitcoind.js
This commit is contained in:
parent
f83be008f3
commit
10aef46050
|
@ -44,17 +44,17 @@ function Bitcoin(options) {
|
|||
}
|
||||
|
||||
if (!this.options.datadir) {
|
||||
this.options.datadir = process.env.HOME + '/.bitcoin';
|
||||
this.options.datadir = '~/.bitcoind.js';
|
||||
}
|
||||
|
||||
this.options.datadir = this.options.datadir.replace(/^~/, process.env.HOME);
|
||||
|
||||
this.config = this.options.datadir + '/bitcoin.conf';
|
||||
|
||||
this.datadir = this.options.datadir;
|
||||
this.config = this.datadir + '/bitcoin.conf';
|
||||
this.network = Bitcoin[this.options.testnet ? 'testnet' : 'livenet'];
|
||||
|
||||
if (!fs.existsSync(this.options.datadir)) {
|
||||
mkdirp.sync(this.options.datadir);
|
||||
if (!fs.existsSync(this.datadir)) {
|
||||
mkdirp.sync(this.datadir);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(this.config)) {
|
||||
|
@ -154,10 +154,10 @@ Bitcoin.prototype.start = function(options, callback) {
|
|||
callback = utils.NOOP;
|
||||
}
|
||||
|
||||
if (this.instances[this.options.datadir]) {
|
||||
if (this.instances[this.datadir]) {
|
||||
return;
|
||||
}
|
||||
this.instances[this.options.datadir] = true;
|
||||
this.instances[this.datadir] = true;
|
||||
|
||||
var none = {};
|
||||
var isSignal = {};
|
||||
|
|
|
@ -657,6 +657,9 @@ async_start_node(uv_work_t *req) {
|
|||
async_node_data *data = static_cast<async_node_data*>(req->data);
|
||||
if (data->datadir != "") {
|
||||
g_data_dir = (char *)data->datadir.c_str();
|
||||
} else {
|
||||
g_data_dir = (char *)malloc(sizeof(char) * 512);
|
||||
snprintf(g_data_dir, sizeof(char) * 512, "%s/.bitcoind.js", getenv("HOME"));
|
||||
}
|
||||
g_rpc = (bool)data->rpc;
|
||||
g_testnet = (bool)data->testnet;
|
||||
|
|
Loading…
Reference in New Issue