fix(@embark-ganache): fix ganache having different node accounts

When using accounts, yes those account are always the same, but
ganache still creates it's own accounts, with a random mnemonic.
So Plugins that rely on the node accounts were crashing on second
run, because the node accounts were no longer the same.
This commit is contained in:
Jonathan Rainville 2020-03-18 13:12:13 -04:00 committed by Pascal Precht
parent fde1eeb3a7
commit 897aa3f839
1 changed files with 1 additions and 3 deletions

View File

@ -53,8 +53,6 @@ class Ganache {
// => https://github.com/trufflesuite/ganache-cli/issues/558 // => https://github.com/trufflesuite/ganache-cli/issues/558
this.embark.fs.ensureDirSync(blockchainConfig.datadir); this.embark.fs.ensureDirSync(blockchainConfig.datadir);
const hasAccounts = blockchainConfig.accounts && blockchainConfig.accounts.length;
const isTest = this.embark.currentContext.includes('test'); const isTest = this.embark.currentContext.includes('test');
this.currentProvider = ganache.provider({ this.currentProvider = ganache.provider({
@ -65,7 +63,7 @@ class Ganache {
network_id: blockchainConfig.networkId || 1337, network_id: blockchainConfig.networkId || 1337,
db_path: isTest ? '' : blockchainConfig.datadir, db_path: isTest ? '' : blockchainConfig.datadir,
default_balance_ether: '99999', default_balance_ether: '99999',
mnemonic: hasAccounts || isTest ? '' : constants.blockchain.defaultMnemonic mnemonic: isTest ? '' : constants.blockchain.defaultMnemonic
}); });
return this.currentProvider; return this.currentProvider;
} }