Skip to content

Commit

Permalink
console: bugfix that causes the console to crash when connection to a…
Browse files Browse the repository at this point in the history
…n endpoint without the personal api enabled
  • Loading branch information
Bas van Kervel committed Dec 18, 2015
1 parent fd69d2b commit 3c9a2c7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/geth/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,12 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
// Override the unlockAccount and newAccount methods on the personal object since these require user interaction.
// Assign the jeth.unlockAccount and jeth.newAccount in the jsre the original web3 callbacks. These will be called
// by the jeth.* methods after they got the password from the user and send the original web3 request to the backend.
persObj := p.Object()
js.re.Run(`jeth.unlockAccount = personal.unlockAccount;`)
persObj.Set("unlockAccount", jeth.UnlockAccount)
js.re.Run(`jeth.newAccount = personal.newAccount;`)
persObj.Set("newAccount", jeth.NewAccount)
if persObj := p.Object(); persObj != nil { // make sure the personal api is enabled over the interface
js.re.Run(`jeth.unlockAccount = personal.unlockAccount;`)
persObj.Set("unlockAccount", jeth.UnlockAccount)
js.re.Run(`jeth.newAccount = personal.newAccount;`)
persObj.Set("newAccount", jeth.NewAccount)
}

return nil
}
Expand Down

0 comments on commit 3c9a2c7

Please sign in to comment.