This commit is contained in:
obscuren
2015-03-18 18:23:37 +01:00
10 changed files with 92 additions and 78 deletions

View File

@ -124,17 +124,8 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)
return reqParsed, nil
}
func toHex(b []byte) string {
hex := common.Bytes2Hex(b)
// Prefer output of "0x0" instead of "0x"
if len(hex) == 0 {
hex = "0"
}
return "0x" + hex
}
func i2hex(n int) string {
return toHex(big.NewInt(int64(n)).Bytes())
return common.ToHex(big.NewInt(int64(n)).Bytes())
}
type RpcServer interface {
@ -156,7 +147,7 @@ func toLogs(logs state.Logs) (ls []Log) {
var l Log
l.Topic = make([]string, len(log.Topics()))
l.Address = log.Address().Hex()
l.Data = toHex(log.Data())
l.Data = common.ToHex(log.Data())
l.Number = log.Number()
for j, topic := range log.Topics() {
l.Topic[j] = topic.Hex()