Skip to content

Commit eb82ca4

Browse files
committed
rpc/js coinbase returns null if no etherbase set
1 parent 09b6983 commit eb82ca4

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎cmd/geth/js_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func TestAccounts(t *testing.T) {
140140
defer os.RemoveAll(tmp)
141141

142142
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`)
143-
checkEvalJSON(t, repl, `eth.coinbase`, `"`+common.Address{}.Hex()+`"`)
143+
checkEvalJSON(t, repl, `eth.coinbase`, `null`)
144144

145145
val, err := repl.re.Run(`personal.newAccount("password")`)
146146
if err != nil {
@@ -151,9 +151,7 @@ func TestAccounts(t *testing.T) {
151151
t.Errorf("address not hex: %q", addr)
152152
}
153153

154-
// skip until order fixed #824
155154
// checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`", "`+addr+`"]`)
156-
// checkEvalJSON(t, repl, `eth.coinbase`, `"`+testAddress+`"`)
157155
}
158156

159157
func TestBlockChain(t *testing.T) {

‎xeth/xeth.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ func (self *XEth) IsListening() bool {
477477
}
478478

479479
func (self *XEth) Coinbase() string {
480-
eb, _ := self.backend.Etherbase()
480+
eb, err := self.backend.Etherbase()
481+
if err != nil {
482+
return "0x0"
483+
}
481484
return eb.Hex()
482485
}
483486

0 commit comments

Comments
 (0)