Browse Source

cleanup rpc/handlers

pull/43/merge
Jae Kwon 10 years ago
parent
commit
e257307b01
4 changed files with 125 additions and 151 deletions
  1. +2
    -2
      daemon/daemon.go
  2. +116
    -142
      rpc/handlers.go
  3. +4
    -4
      rpc/test/json_rpc_test.go
  4. +3
    -3
      rpc/test/test.go

+ 2
- 2
daemon/daemon.go View File

@ -150,7 +150,7 @@ func (n *Node) DialSeed() {
}
}
func (n *Node) StartRpc() {
func (n *Node) StartRPC() {
core.SetBlockStore(n.blockStore)
core.SetConsensusState(n.consensusState)
core.SetMempoolReactor(n.mempoolReactor)
@ -185,7 +185,7 @@ func Daemon() {
// Run the RPC server.
if config.App().GetString("RPC.HTTP.ListenAddr") != "" {
n.StartRpc()
n.StartRPC()
}
// Sleep forever and then...


rpc/http_handlers.go → rpc/handlers.go View File


+ 4
- 4
rpc/test/json_rpc_test.go View File

@ -18,8 +18,8 @@ import (
)
func TestJSONStatus(t *testing.T) {
s := rpc.JsonRpc{
JsonRpc: "2.0",
s := rpc.JSONRPC{
JSONRPC: "2.0",
Method: "status",
Params: []interface{}{},
Id: 0,
@ -53,8 +53,8 @@ func TestJSONStatus(t *testing.T) {
}
func TestJSONGenPriv(t *testing.T) {
s := rpc.JsonRpc{
JsonRpc: "2.0",
s := rpc.JSONRPC{
JSONRPC: "2.0",
Method: "unsafe/gen_priv_account",
Params: []interface{}{},
Id: 0,


+ 3
- 3
rpc/test/test.go View File

@ -41,7 +41,7 @@ func newNode(ready chan struct{}) {
node.Start()
// Run the RPC server.
node.StartRpc()
node.StartRPC()
ready <- struct{}{}
// Sleep forever
@ -72,8 +72,8 @@ func getAccount(t *testing.T, typ string, addr []byte) *account.Account {
var err error
switch typ {
case "JSONRPC":
s := rpc.JsonRpc{
JsonRpc: "2.0",
s := rpc.JSONRPC{
JSONRPC: "2.0",
Method: "get_account",
Params: []interface{}{hex.EncodeToString(addr)},
Id: 0,


Loading…
Cancel
Save