diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-18 20:00:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-18 20:00:01 +0800 |
commit | 0a1eeca41e6ba5920ba65d9b41654768299bc7e3 (patch) | |
tree | 0c286872355608c317f9e0ec1897bb79386ae94f /rpc/api.go | |
parent | 942980609fb8a36873689bd3bd0a15488f327d56 (diff) | |
download | dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar.gz dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar.bz2 dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar.lz dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar.xz dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.tar.zst dexon-0a1eeca41e6ba5920ba65d9b41654768299bc7e3.zip |
conversions. -compilable-
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/rpc/api.go b/rpc/api.go index 079347192..3c46684d1 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -668,7 +668,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return NewValidationError("Index", "does not exist") } - uncle, err := p.GetBlockByHash(toHex(v.Uncles[args.Index]), false) + uncle, err := p.GetBlockByHash(v.Uncles[args.Index].Hex(), false) if err != nil { return err } @@ -687,7 +687,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return NewValidationError("Index", "does not exist") } - uncle, err := p.GetBlockByHash(toHex(v.Uncles[args.Index]), false) + uncle, err := p.GetBlockByHash(v.Uncles[args.Index].Hex(), false) if err != nil { return err } @@ -832,12 +832,12 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions { // Convert optional address slice/string to byte slice if str, ok := options.Address.(string); ok { - opts.Address = [][]byte{common.FromHex(str)} + opts.Address = []common.Address{common.HexToAddress(str)} } else if slice, ok := options.Address.([]interface{}); ok { - bslice := make([][]byte, len(slice)) + bslice := make([]common.Address, len(slice)) for i, addr := range slice { if saddr, ok := addr.(string); ok { - bslice[i] = common.FromHex(saddr) + bslice[i] = common.HexToAddress(saddr) } } opts.Address = bslice @@ -846,16 +846,15 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions { opts.Earliest = options.Earliest opts.Latest = options.Latest - topics := make([][][]byte, len(options.Topics)) + topics := make([][]common.Hash, len(options.Topics)) for i, topicDat := range options.Topics { if slice, ok := topicDat.([]interface{}); ok { - topics[i] = make([][]byte, len(slice)) + topics[i] = make([]common.Hash, len(slice)) for j, topic := range slice { - topics[i][j] = common.FromHex(topic.(string)) + topics[i][j] = common.HexToHash(topic.(string)) } } else if str, ok := topicDat.(string); ok { - topics[i] = make([][]byte, 1) - topics[i][0] = common.FromHex(str) + topics[i] = []common.Hash{common.HexToHash(str)} } } opts.Topics = topics |