aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-30 03:41:10 +0800
committerobscuren <geffobscura@gmail.com>2015-01-30 03:41:10 +0800
commitbd992e7baf5da01e97fe4e0c85184716daafa7e5 (patch)
treed159e9d44c6a9b90497d01ba8663865d3f7c8b98 /rpc
parent0031f388ac1f6f4a23c5c75e5eeb4a007f0b2f31 (diff)
parent447bad9dbd9ef033332b1166f7ac95aab5b82e43 (diff)
downloadgo-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar.gz
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar.bz2
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar.lz
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar.xz
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.tar.zst
go-tangerine-bd992e7baf5da01e97fe4e0c85184716daafa7e5.zip
Merge branch 'qt5.4' of github.com-obscure:ethereum/go-ethereum into qt5.4
Conflicts: rpc/message.go
Diffstat (limited to 'rpc')
-rw-r--r--rpc/message.go25
-rw-r--r--rpc/packages.go18
-rw-r--r--rpc/util.go (renamed from rpc/json.go)43
-rw-r--r--rpc/ws/server.go2
4 files changed, 44 insertions, 44 deletions
diff --git a/rpc/message.go b/rpc/message.go
index a76eaece4..5045adb8f 100644
--- a/rpc/message.go
+++ b/rpc/message.go
@@ -21,8 +21,6 @@ import (
"encoding/json"
"errors"
"fmt"
-
- "github.com/ethereum/go-ethereum/state"
)
const (
@@ -232,29 +230,6 @@ func (req *RpcRequest) ToFilterChangedArgs() (int, error) {
return id, nil
}
-type Log struct {
- Address string `json:"address"`
- Topics []string `json:"topics"`
- Data string `json:"data"`
-}
-
-func toLogs(logs state.Logs) (ls []Log) {
- ls = make([]Log, len(logs))
-
- for i, log := range logs {
- var l Log
- l.Topics = make([]string, len(log.Topics()))
- l.Address = toHex(log.Address())
- l.Data = toHex(log.Data())
- for j, topic := range log.Topics() {
- l.Topics[j] = toHex(topic)
- }
- ls[i] = l
- }
-
- return
-}
-
func (req *RpcRequest) ToDbPutArgs() (*DbArgs, error) {
if len(req.Params) < 3 {
return nil, NewErrorResponse(ErrorArguments)
diff --git a/rpc/packages.go b/rpc/packages.go
index 2de1f06cd..6136adf49 100644
--- a/rpc/packages.go
+++ b/rpc/packages.go
@@ -40,24 +40,6 @@ 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()
-}
-
type EthereumApi struct {
xeth *xeth.XEth
filterManager *filter.FilterManager
diff --git a/rpc/json.go b/rpc/util.go
index 9bd204818..bb4087c51 100644
--- a/rpc/json.go
+++ b/rpc/util.go
@@ -21,6 +21,8 @@ import (
"github.com/ethereum/go-ethereum/logger"
"io"
"net/http"
+ "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/state"
)
var rpclogger = logger.NewLogger("RPC")
@@ -56,3 +58,44 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)
return reqParsed, nil
}
+
+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()
+}
+
+type Log struct {
+ Address string `json:"address"`
+ Topics []string `json:"topics"`
+ Data string `json:"data"`
+}
+
+func toLogs(logs state.Logs) (ls []Log) {
+ ls = make([]Log, len(logs))
+
+ for i, log := range logs {
+ var l Log
+ l.Topics = make([]string, len(log.Topics()))
+ l.Address = toHex(log.Address())
+ l.Data = toHex(log.Data())
+ for j, topic := range log.Topics() {
+ l.Topics[j] = toHex(topic)
+ }
+ ls[i] = l
+ }
+
+ return
+}
diff --git a/rpc/ws/server.go b/rpc/ws/server.go
index 37b08ebd9..2853181ec 100644
--- a/rpc/ws/server.go
+++ b/rpc/ws/server.go
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
-package ws
+package rpcws
import (
"fmt"