aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/miner_args.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-07-07 17:55:33 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-07-07 17:55:33 +0800
commite5fba8fd7025bb45a88a19c1bbef80db5bd3b688 (patch)
treeb17726c936fcb695e26b2a145b5d423b8556871b /rpc/api/miner_args.go
parent916d1554675974adb92af4046e1b04ad3b26dca3 (diff)
parent37c1a8f69de44827a60296342189b6719a49dbc3 (diff)
downloaddexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar.gz
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar.bz2
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar.lz
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar.xz
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.tar.zst
dexon-e5fba8fd7025bb45a88a19c1bbef80db5bd3b688.zip
Merge pull request #1428 from obscuren/coinbase-fixes
cmd,eth,rpc,tests: default coinbase
Diffstat (limited to 'rpc/api/miner_args.go')
-rw-r--r--rpc/api/miner_args.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/rpc/api/miner_args.go b/rpc/api/miner_args.go
index 7b0560c16..9da3b95ad 100644
--- a/rpc/api/miner_args.go
+++ b/rpc/api/miner_args.go
@@ -5,6 +5,7 @@ import (
"math/big"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc/shared"
)
@@ -76,6 +77,31 @@ func (args *GasPriceArgs) UnmarshalJSON(b []byte) (err error) {
return shared.NewInvalidTypeError("Price", "not a string")
}
+type SetEtherbaseArgs struct {
+ Etherbase common.Address
+}
+
+func (args *SetEtherbaseArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return shared.NewDecodeParamError(err.Error())
+ }
+
+ if len(obj) < 1 {
+ return shared.NewInsufficientParamsError(len(obj), 1)
+ }
+
+ if addr, ok := obj[0].(string); ok {
+ args.Etherbase = common.HexToAddress(addr)
+ if (args.Etherbase == common.Address{}) {
+ return shared.NewInvalidTypeError("Etherbase", "not a valid address")
+ }
+ return nil
+ }
+
+ return shared.NewInvalidTypeError("Etherbase", "not a string")
+}
+
type MakeDAGArgs struct {
BlockNumber int64
}