cmd,eth,rpc,tests: default coinbase

This commit is contained in:
Jeffrey Wilcke
2015-07-07 10:32:05 +02:00
parent d764bd0584
commit 35cd355c14
10 changed files with 87 additions and 51 deletions

View File

@ -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
}