Merge pull request #1444 from ethereum/yann300-patch-19

Commit added vm acount (for fixing account balance)
pull/1/head
yann300 7 years ago committed by GitHub
commit d3f2135953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/universal-dapp.js

@ -82,6 +82,7 @@ UniversalDApp.prototype.resetAPI = function (transactionContextAPI) {
UniversalDApp.prototype.createVMAccount = function (privateKey, balance, cb) {
this._addAccount(privateKey, balance)
executionContext.vm().stateManager.cache.flush(function () {})
privateKey = new Buffer(privateKey, 'hex')
cb(null, '0x' + ethJSUtil.privateToAddress(privateKey).toString('hex'))
}
@ -104,6 +105,7 @@ UniversalDApp.prototype.newAccount = function (password, cb) {
privateKey = crypto.randomBytes(32)
} while (!ethJSUtil.isValidPrivate(privateKey))
this._addAccount(privateKey, '0x56BC75E2D63100000')
executionContext.vm().stateManager.cache.flush(function () {})
cb(null, '0x' + ethJSUtil.privateToAddress(privateKey).toString('hex'))
}
}

Loading…
Cancel
Save