Skip to content

Commit 71e9eed

Browse files
committed
use config password file; tolerate somethign going terribly wrong since it wouldnt' affect the blockchain process generally
1 parent 69f356b commit 71e9eed

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

lib/cmds/blockchain/dev_funds.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ const {readFileSync, dappPath} = require('../../core/fs');
55

66
class DevFunds {
77
constructor(blockchainConfig) {
8-
this.web3 = null;
9-
this.blockchainConfig = blockchainConfig;
10-
this.accounts = [];
11-
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
12-
this.password = readFileSync(dappPath('config/development/password'), 'utf8').replace('\n', '');
13-
this.web3 = new Web3();
14-
this.networkId = null;
15-
this.balance = Web3.utils.toWei("1", "ether");
16-
if (this.blockchainConfig.account.balance) {
17-
this.balance = getWeiBalanceFromString(this.blockchainConfig.account.balance, this.web3);
8+
// TODO: temporary to avoid nasty suprises, should be removed
9+
try {
10+
this.web3 = null;
11+
this.blockchainConfig = blockchainConfig;
12+
this.accounts = [];
13+
this.numAccounts = this.blockchainConfig.account.numAccounts || 0;
14+
this.password = readFileSync(dappPath(blockchainConfig.account.password), 'utf8').replace('\n', '');
15+
this.web3 = new Web3();
16+
this.networkId = null;
17+
this.balance = Web3.utils.toWei("1", "ether");
18+
if (this.blockchainConfig.account.balance) {
19+
this.balance = getWeiBalanceFromString(this.blockchainConfig.account.balance, this.web3);
20+
}
21+
} catch(_err) {
1822
}
1923
}
2024

@@ -95,6 +99,9 @@ class DevFunds {
9599
}
96100

97101
createFundAndUnlockAccounts(cb) {
102+
if (!this.web3) {
103+
return cb();
104+
}
98105
async.waterfall([
99106
(next) => {
100107
this.connectToNode(next);

0 commit comments

Comments
 (0)