aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-29 21:46:59 +0800
committerobscuren <geffobscura@gmail.com>2015-01-29 21:46:59 +0800
commitddf17d93acf92ef18b0134f19f22220362e06bad (patch)
tree1e506bd62ba922f915f9fef2cb90b5f7d710afb5 /rpc
parent84adf77bf3492351de82f0ec820a1d280e85a5cd (diff)
downloadgo-tangerine-ddf17d93acf92ef18b0134f19f22220362e06bad.tar.gz
go-tangerine-ddf17d93acf92ef18b0134f19f22220362e06bad.tar.zst
go-tangerine-ddf17d93acf92ef18b0134f19f22220362e06bad.zip
Samples and disams cmd for evm code
Diffstat (limited to 'rpc')
-rw-r--r--rpc/packages.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/rpc/packages.go b/rpc/packages.go
index 4302f6018..b25660b25 100644
--- a/rpc/packages.go
+++ b/rpc/packages.go
@@ -35,6 +35,19 @@ import (
"github.com/ethereum/go-ethereum/xeth"
)
+func toHex(b []byte) string {
+ return "0x" + ethutil.Bytes2Hex(b)
+}
+func fromHex(s string) []byte {
+ if len(s) > 1 {
+ if s[0:2] == "0x" {
+ s = s[2:]
+ }
+ return ethutil.Hex2Bytes(s)
+ }
+ return nil
+}
+
type RpcServer interface {
Start()
Stop()
@@ -163,7 +176,7 @@ func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error {
}
func (p *EthereumApi) Sha3(args *Sha3Args, reply *interface{}) error {
- *reply = ethutil.Bytes2Hex(crypto.Sha3(ethutil.Hex2Bytes(args.Data)))
+ *reply = toHex(crypto.Sha3(fromHex(args.Data)))
return nil
}