OSDN Git Service
(root)
/
bytom
/
vapor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reward util (#342)
[bytom/vapor.git]
/
util
/
util.go
diff --git
a/util/util.go
b/util/util.go
index
1bf38e9
..
e77696b
100644
(file)
--- a/
util/util.go
+++ b/
util/util.go
@@
-4,6
+4,7
@@
import (
"context"
jww "github.com/spf13/jwalterweatherman"
"context"
jww "github.com/spf13/jwalterweatherman"
+ "github.com/vapor/api"
"github.com/vapor/blockchain/rpc"
"github.com/vapor/env"
)
"github.com/vapor/blockchain/rpc"
"github.com/vapor/env"
)
@@
-13,17
+14,17
@@
const (
Success = iota
// ErrLocalExe indicates error occurs before the rpc calling.
ErrLocalExe
Success = iota
// ErrLocalExe indicates error occurs before the rpc calling.
ErrLocalExe
- // ErrConnect indicates error occurs connecting to the
bytom
d, e.g.,
- //
bytom
d can't parse the received arguments.
+ // ErrConnect indicates error occurs connecting to the
vapor
d, e.g.,
+ //
vapor
d can't parse the received arguments.
ErrConnect
// ErrLocalParse indicates error occurs locally when parsing the response.
ErrLocalParse
ErrConnect
// ErrLocalParse indicates error occurs locally when parsing the response.
ErrLocalParse
- // ErrRemote indicates error occurs in
bytom
d.
+ // ErrRemote indicates error occurs in
vapor
d.
ErrRemote
)
var (
ErrRemote
)
var (
- coreURL = env.String("BYTOM_URL", "http://
localhost:8888
")
+ coreURL = env.String("BYTOM_URL", "http://
127.0.0.1:9889
")
)
// Wraper rpc's client
)
// Wraper rpc's client
@@
-35,7
+36,7
@@
func MustRPCClient() *rpc.Client {
// Wrapper rpc call api.
func ClientCall(path string, req ...interface{}) (interface{}, int) {
// Wrapper rpc call api.
func ClientCall(path string, req ...interface{}) (interface{}, int) {
- var response = &Response{}
+ var response = &
api.
Response{}
var request interface{}
if req != nil {
var request interface{}
if req != nil {
@@
-46,11
+47,11
@@
func ClientCall(path string, req ...interface{}) (interface{}, int) {
client.Call(context.Background(), path, request, response)
switch response.Status {
client.Call(context.Background(), path, request, response)
switch response.Status {
- case
"fail"
:
+ case
api.FAIL
:
jww.ERROR.Println(response.Msg)
return nil, ErrRemote
case "":
jww.ERROR.Println(response.Msg)
return nil, ErrRemote
case "":
- jww.ERROR.Println("Unable to connect to the
bytom
d")
+ jww.ERROR.Println("Unable to connect to the
vapor
d")
return nil, ErrConnect
}
return nil, ErrConnect
}