mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
@@ -42,12 +42,12 @@ func (e *EventMeter) Call(callback string, args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
type RpcClient struct {
|
||||
type RPCClient struct {
|
||||
Stubs map[string]interface{}
|
||||
cdc *amino.Codec
|
||||
}
|
||||
|
||||
func (c *RpcClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) {
|
||||
func (c *RPCClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) {
|
||||
s, ok := c.Stubs[method]
|
||||
if !ok {
|
||||
stdlog.Fatalf("Call to %s, but no stub is defined for it", method)
|
||||
@@ -60,10 +60,10 @@ func (c *RpcClient) Call(method string, params map[string]interface{}, result in
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (c *RpcClient) Codec() *amino.Codec {
|
||||
func (c *RPCClient) Codec() *amino.Codec {
|
||||
return c.cdc
|
||||
}
|
||||
|
||||
func (c *RpcClient) SetCodec(cdc *amino.Codec) {
|
||||
func (c *RPCClient) SetCodec(cdc *amino.Codec) {
|
||||
c.cdc = cdc
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ func (m *Monitor) updateNumValidatorLoop() {
|
||||
m.mtx.Lock()
|
||||
nodesCount := len(m.Nodes)
|
||||
m.mtx.Unlock()
|
||||
if 0 == nodesCount {
|
||||
if nodesCount == 0 {
|
||||
time.Sleep(m.numValidatorsUpdateInterval)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ func createValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter
|
||||
}
|
||||
stubs["status"] = ctypes.ResultStatus{ValidatorInfo: ctypes.ValidatorInfo{PubKey: pubKey}}
|
||||
cdc := amino.NewCodec()
|
||||
rpcClientMock := &mock.RpcClient{Stubs: stubs}
|
||||
rpcClientMock := &mock.RPCClient{Stubs: stubs}
|
||||
rpcClientMock.SetCodec(cdc)
|
||||
|
||||
n = monitor.NewNodeWithEventMeterAndRpcClient("tcp://127.0.0.1:26657", emMock, rpcClientMock)
|
||||
n = monitor.NewNodeWithEventMeterAndRPCClient("tcp://127.0.0.1:26657", emMock, rpcClientMock)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ func NewNode(rpcAddr string, options ...func(*Node)) *Node {
|
||||
em := em.NewEventMeter(rpcAddr, UnmarshalEvent)
|
||||
rpcClient := rpc_client.NewURIClient(rpcAddr) // HTTP client by default
|
||||
rpcClient.SetCodec(cdc)
|
||||
return NewNodeWithEventMeterAndRpcClient(rpcAddr, em, rpcClient, options...)
|
||||
return NewNodeWithEventMeterAndRPCClient(rpcAddr, em, rpcClient, options...)
|
||||
}
|
||||
|
||||
func NewNodeWithEventMeterAndRpcClient(
|
||||
func NewNodeWithEventMeterAndRPCClient(
|
||||
rpcAddr string,
|
||||
em eventMeter,
|
||||
rpcClient rpc_client.HTTPClient,
|
||||
@@ -184,7 +184,7 @@ func (n *Node) RestartEventMeterBackoff() error {
|
||||
attempt++
|
||||
|
||||
if attempt > maxRestarts {
|
||||
return errors.New("Reached max restarts")
|
||||
return errors.New("reached max restarts")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,10 +85,10 @@ func startValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter)
|
||||
}
|
||||
stubs["status"] = ctypes.ResultStatus{ValidatorInfo: ctypes.ValidatorInfo{PubKey: pubKey}}
|
||||
cdc := amino.NewCodec()
|
||||
rpcClientMock := &mock.RpcClient{Stubs: stubs}
|
||||
rpcClientMock := &mock.RPCClient{Stubs: stubs}
|
||||
rpcClientMock.SetCodec(cdc)
|
||||
|
||||
n = monitor.NewNodeWithEventMeterAndRpcClient("tcp://127.0.0.1:26657", emMock, rpcClientMock)
|
||||
n = monitor.NewNodeWithEventMeterAndRPCClient("tcp://127.0.0.1:26657", emMock, rpcClientMock)
|
||||
|
||||
err := n.Start()
|
||||
require.Nil(t, err)
|
||||
|
||||
Reference in New Issue
Block a user