From f49e17eb392e7cabacc81146882024fd0e10a1d9 Mon Sep 17 00:00:00 2001
From: Taylor Gerring <taylor.gerring@gmail.com>
Date: Fri, 13 Mar 2015 14:32:11 -0400
Subject: [PATCH] Return null coinbase when accounts not created
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Was previously returning nonsensical “0x”
---
 rpc/api.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/rpc/api.go b/rpc/api.go
index af9f10530..ec827a77b 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -490,7 +490,13 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
 	case "net_peerCount":
 		*reply = toHex(big.NewInt(int64(p.xeth().PeerCount())).Bytes())
 	case "eth_coinbase":
-		*reply = p.xeth().Coinbase()
+		// TODO handling of empty coinbase due to lack of accounts
+		res := p.xeth().Coinbase()
+		if res == "0x" || res == "0x0" {
+			*reply = nil
+		} else {
+			*reply = res
+		}
 	case "eth_mining":
 		*reply = p.xeth().IsMining()
 	case "eth_gasPrice":
-- 
GitLab