aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/miner_args.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:32:05 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:32:05 +0800
commit35cd355c14d9a5266a7d4b11127d25eb7f961494 (patch)
tree879c8d86b8865f733c73992e8c04c71d52152437 /rpc/api/miner_args.go
parentd764bd058457cd9eb91d205d1ac187d40c4866d6 (diff)
downloaddexon-35cd355c14d9a5266a7d4b11127d25eb7f961494.tar.gz
dexon-35cd355c14d9a5266a7d4b11127d25eb7f961494.tar.zst
dexon-35cd355c14d9a5266a7d4b11127d25eb7f961494.zip
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
}