Merge pull request #878 from embark-framework/bug_fix/minewhenneeded-fixes-3

Fix datadir for miner (PR for next branch)
This commit is contained in:
Iuri Matias 2018-09-21 09:36:06 -04:00 committed by GitHub
commit 71cbb07ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -251,7 +251,7 @@ Blockchain.prototype.readyCallback = function() {
if (this.config.mineWhenNeeded && !this.isDev) { if (this.config.mineWhenNeeded && !this.isDev) {
const GethMiner = require('./miner'); const GethMiner = require('./miner');
this.miner = new GethMiner(); this.miner = new GethMiner({datadir: this.blockchainConfig.datadir});
} }
}; };
@ -336,7 +336,7 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
}; };
var BlockchainClient = function(blockchainConfig, client, env, onReadyCallback, onExitCallback) { var BlockchainClient = function(blockchainConfig, client, env, onReadyCallback, onExitCallback) {
const isDev = blockchainConfig.isDev || blockchainConfig.default; const isDev = !!blockchainConfig.isDev;
// TODO add other clients at some point // TODO add other clients at some point
if (client === 'geth') { if (client === 'geth') {
return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback}); return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback});

View File

@ -13,11 +13,12 @@ const getChanges = 'eth_getFilterChanges';
const getBlockCount = 'eth_getBlockTransactionCountByNumber'; const getBlockCount = 'eth_getBlockTransactionCountByNumber';
class GethMiner { class GethMiner {
constructor() { constructor(options) {
const self = this; const self = this;
// TODO: Find a way to load mining config from YML. // TODO: Find a way to load mining config from YML.
// In the meantime, just set an empty config object // In the meantime, just set an empty config object
this.config = {}; this.config = {};
this.datadir = options.datadir;
self.interval = null; self.interval = null;
self.callback = null; self.callback = null;
self.started = null; self.started = null;