Removed `mineWhenNeeded` condition

Removed a condition that detects if `mineWhenNeeded === true`. While reaslistically, the `defaultAccount` will only be populated when `mineWhenNeeded` is set, there is no need to check for this when falling back to the blockchain account.
This commit is contained in:
emizzle 2018-10-19 16:57:46 +11:00 committed by Pascal Precht
parent 294e14446f
commit 178115de18
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 3 additions and 5 deletions

View File

@ -25,18 +25,16 @@ class SwarmProcess extends ProcessWrapper {
password = fs.dappPath(this.storageConfig.account.password); password = fs.dappPath(this.storageConfig.account.password);
} }
// default to our blockchain config account, or our default account // default to our blockchain config account, or our default account
else if (!this.blockchainConfig.isDev && else if (this.blockchainConfig.account &&
this.blockchainConfig.mineWhenNeeded &&
this.blockchainConfig.account &&
(this.blockchainConfig.account.address || this.defaultAccount) && (this.blockchainConfig.account.address || this.defaultAccount) &&
this.blockchainConfig.account.password this.blockchainConfig.account.password
) { ) {
// defaultAccount is populated from blockchain_connector.determineDefaultAccount which is either // defaultAccount is populated from blockchain_connector.determineDefaultAccount which is either
// config/blockchain.js > account > address or the first address returned from web3.eth.getAccounts // config/blockchain.js > account > address or the first address returned from web3.eth.getAccounts
// (usually the default account) // (usually the default account)
bzzaccount = this.defaultAccount; bzzaccount = this.blockchainConfig.account.address || this.defaultAccount;
password = fs.dappPath(this.blockchainConfig.account.password); password = fs.dappPath(this.blockchainConfig.account.password);
console.trace(`Swarm account/password falling back to the blockchain account ${this.defaultAccount}. The account is either specified in config/blockchain.js > account > address or is the first address returned from web3.eth.getAccounts. The password is specified in config/blockchain.js > account > address.`); console.trace(`Swarm account/password falling back to the blockchain account ${this.blockchainConfig.account.address || this.defaultAccount}. The account is either specified in config/blockchain.js > account > address or is the first address returned from web3.eth.getAccounts. The password is specified in config/blockchain.js > account > address.`);
} }
else { else {
return 'Account address and password are needed in the storage config to start the Swarm process'; return 'Account address and password are needed in the storage config to start the Swarm process';