cleanup of javascript API

This commit is contained in:
Bas van Kervel
2015-06-10 11:29:52 +02:00
committed by Bas van Kervel
parent 87b62f75a7
commit bd38428f33
10 changed files with 91 additions and 89 deletions

View File

@ -3,8 +3,6 @@ package api
import (
"encoding/json"
"math/big"
"github.com/ethereum/go-ethereum/rpc/shared"
)
@ -68,16 +66,8 @@ func (args *VerbosityArgs) UnmarshalJSON(b []byte) (err error) {
return shared.NewDecodeParamError("Expected enode as argument")
}
if levelint, ok := obj[0].(int); ok {
args.Level = levelint
} else if levelstr, ok := obj[0].(string); ok {
if !ok {
return shared.NewInvalidTypeError("level", "not a string")
}
level, success := new(big.Int).SetString(levelstr, 0)
if !success {
return shared.NewDecodeParamError("Unable to parse verbosity level")
}
level, err := numString(obj[0])
if err == nil {
args.Level = int(level.Int64())
}