commit
72b2be51ec
|
@ -37,7 +37,9 @@ func main() {
|
||||||
for i := 0; ; i++ {
|
for i := 0; ; i++ {
|
||||||
binary.BigEndian.PutUint64(buf, uint64(i))
|
binary.BigEndian.PutUint64(buf, uint64(i))
|
||||||
//txBytes := hex.EncodeToString(buf[:n])
|
//txBytes := hex.EncodeToString(buf[:n])
|
||||||
request := rpctypes.NewRPCRequest("fakeid", "broadcast_tx", Arr(buf[:8]))
|
request := rpctypes.NewRPCRequest("fakeid",
|
||||||
|
"broadcast_tx",
|
||||||
|
map[string]interface{}{"tx": buf[:8]})
|
||||||
reqBytes := wire.JSONBytes(request)
|
reqBytes := wire.JSONBytes(request)
|
||||||
//fmt.Println("!!", string(reqBytes))
|
//fmt.Println("!!", string(reqBytes))
|
||||||
fmt.Print(".")
|
fmt.Print(".")
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
hash: 81cd41d28f9a747a71e6a47e8bc7d855846df29f359ffdcc8d1645c451112b31
|
hash: d9724aa287c40d1b3856b6565f09235d809c8b2f7c6537c04f597137c0d6cd26
|
||||||
updated: 2017-03-06T17:34:23.99160606-05:00
|
updated: 2017-04-11T15:24:16.619608243-04:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/btcsuite/btcd
|
- name: github.com/btcsuite/btcd
|
||||||
version: 583684b21bfbde9b5fc4403916fd7c807feb0289
|
version: b8df516b4b267acf2de46be593a9d948d1d2c420
|
||||||
subpackages:
|
subpackages:
|
||||||
- btcec
|
- btcec
|
||||||
|
- name: github.com/btcsuite/fastsha256
|
||||||
|
version: 637e656429416087660c84436a2a035d69d54e2e
|
||||||
- name: github.com/BurntSushi/toml
|
- name: github.com/BurntSushi/toml
|
||||||
version: 99064174e013895bbd9b025c31100bd1d9b590ca
|
version: 99064174e013895bbd9b025c31100bd1d9b590ca
|
||||||
- name: github.com/davecgh/go-spew
|
- name: github.com/davecgh/go-spew
|
||||||
|
@ -16,7 +18,7 @@ imports:
|
||||||
- name: github.com/go-stack/stack
|
- name: github.com/go-stack/stack
|
||||||
version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82
|
version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82
|
||||||
- name: github.com/gogo/protobuf
|
- name: github.com/gogo/protobuf
|
||||||
version: 909568be09de550ed094403c2bf8a261b5bb730a
|
version: 100ba4e885062801d56799d78530b73b178a78f3
|
||||||
subpackages:
|
subpackages:
|
||||||
- proto
|
- proto
|
||||||
- name: github.com/golang/protobuf
|
- name: github.com/golang/protobuf
|
||||||
|
@ -32,9 +34,9 @@ imports:
|
||||||
- name: github.com/jmhodges/levigo
|
- name: github.com/jmhodges/levigo
|
||||||
version: c42d9e0ca023e2198120196f842701bb4c55d7b9
|
version: c42d9e0ca023e2198120196f842701bb4c55d7b9
|
||||||
- name: github.com/mattn/go-colorable
|
- name: github.com/mattn/go-colorable
|
||||||
version: acb9493f2794fd0f820de7a27a217dafbb1b65ea
|
version: 9fdad7c47650b7d2e1da50644c1f4ba7f172f252
|
||||||
- name: github.com/mattn/go-isatty
|
- name: github.com/mattn/go-isatty
|
||||||
version: 9622e0cc9d8f9be434ca605520ff9a16808fee47
|
version: 56b76bdf51f7708750eac80fa38b952bb9f32639
|
||||||
- name: github.com/pkg/errors
|
- name: github.com/pkg/errors
|
||||||
version: 645ef00459ed84a119197bfb8d8205042c6df63d
|
version: 645ef00459ed84a119197bfb8d8205042c6df63d
|
||||||
- name: github.com/pmezard/go-difflib
|
- name: github.com/pmezard/go-difflib
|
||||||
|
@ -66,7 +68,7 @@ imports:
|
||||||
- leveldb/table
|
- leveldb/table
|
||||||
- leveldb/util
|
- leveldb/util
|
||||||
- name: github.com/tendermint/abci
|
- name: github.com/tendermint/abci
|
||||||
version: 1236e8fb6eee3a63909f4014a8e84385ead7933d
|
version: 31eafe8f8eba6b8817edd74df399f508540da528
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- example/counter
|
- example/counter
|
||||||
|
@ -83,15 +85,15 @@ imports:
|
||||||
- name: github.com/tendermint/go-clist
|
- name: github.com/tendermint/go-clist
|
||||||
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
|
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
|
||||||
- name: github.com/tendermint/go-common
|
- name: github.com/tendermint/go-common
|
||||||
version: dcb015dff6c7af21e65c8e2f3b450df19d38c777
|
version: 6af2364fa91ef2f3afc8ba0db33b66d9d3ae006c
|
||||||
subpackages:
|
subpackages:
|
||||||
- test
|
- test
|
||||||
- name: github.com/tendermint/go-config
|
- name: github.com/tendermint/go-config
|
||||||
version: 620dcbbd7d587cf3599dedbf329b64311b0c307a
|
version: 620dcbbd7d587cf3599dedbf329b64311b0c307a
|
||||||
- name: github.com/tendermint/go-crypto
|
- name: github.com/tendermint/go-crypto
|
||||||
version: 3f47cfac5fcd9e0f1727c7db980b3559913b3e3a
|
version: 750b25c47a5782f5f2b773ed9e706cb82b3ccef4
|
||||||
- name: github.com/tendermint/go-data
|
- name: github.com/tendermint/go-data
|
||||||
version: 32271140e8fd5abdbb22e268d7a02421fa382f0b
|
version: e7fcc6d081ec8518912fcdc103188275f83a3ee5
|
||||||
- name: github.com/tendermint/go-db
|
- name: github.com/tendermint/go-db
|
||||||
version: eac3f2bc147023957c8bf69432a4e6c4dc5c3f72
|
version: eac3f2bc147023957c8bf69432a4e6c4dc5c3f72
|
||||||
- name: github.com/tendermint/go-events
|
- name: github.com/tendermint/go-events
|
||||||
|
@ -105,17 +107,17 @@ imports:
|
||||||
- name: github.com/tendermint/go-merkle
|
- name: github.com/tendermint/go-merkle
|
||||||
version: 714d4d04557fd068a7c2a1748241ce8428015a96
|
version: 714d4d04557fd068a7c2a1748241ce8428015a96
|
||||||
- name: github.com/tendermint/go-p2p
|
- name: github.com/tendermint/go-p2p
|
||||||
version: 97a5ed2d1a17eaee8717b8a32cfaf7a9a82a273d
|
version: c39e001a957caf768f06c85c840debb8282c3aaa
|
||||||
subpackages:
|
subpackages:
|
||||||
- upnp
|
- upnp
|
||||||
- name: github.com/tendermint/go-rpc
|
- name: github.com/tendermint/go-rpc
|
||||||
version: fcea0cda21f64889be00a0f4b6d13266b1a76ee7
|
version: 9d18cbe74e66f875afa36d2fa3be280e4a2dc9e6
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- server
|
- server
|
||||||
- types
|
- types
|
||||||
- name: github.com/tendermint/go-wire
|
- name: github.com/tendermint/go-wire
|
||||||
version: f530b7af7a8b06e612c2063bff6ace49060a085e
|
version: ad797c70affa2c81fccc5edaed63ac25144397c6
|
||||||
- name: github.com/tendermint/log15
|
- name: github.com/tendermint/log15
|
||||||
version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6
|
version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6
|
||||||
subpackages:
|
subpackages:
|
||||||
|
@ -127,7 +129,7 @@ imports:
|
||||||
- client
|
- client
|
||||||
- testutil
|
- testutil
|
||||||
- name: golang.org/x/crypto
|
- name: golang.org/x/crypto
|
||||||
version: 40541ccb1c6e64c947ed6f606b8a6cb4b67d7436
|
version: 1f22c0103821b9390939b6776727195525381532
|
||||||
subpackages:
|
subpackages:
|
||||||
- curve25519
|
- curve25519
|
||||||
- nacl/box
|
- nacl/box
|
||||||
|
@ -148,7 +150,7 @@ imports:
|
||||||
- lex/httplex
|
- lex/httplex
|
||||||
- trace
|
- trace
|
||||||
- name: golang.org/x/sys
|
- name: golang.org/x/sys
|
||||||
version: e48874b42435b4347fc52bdee0424a52abc974d7
|
version: 50c6bc5e4292a1d4e65c6e9be5f53be28bcbe28e
|
||||||
subpackages:
|
subpackages:
|
||||||
- unix
|
- unix
|
||||||
- name: google.golang.org/grpc
|
- name: google.golang.org/grpc
|
||||||
|
|
|
@ -10,6 +10,8 @@ import:
|
||||||
version: develop
|
version: develop
|
||||||
- package: github.com/tendermint/go-crypto
|
- package: github.com/tendermint/go-crypto
|
||||||
version: develop
|
version: develop
|
||||||
|
- package: github.com/tendermint/go-data
|
||||||
|
version: develop
|
||||||
- package: github.com/tendermint/go-db
|
- package: github.com/tendermint/go-db
|
||||||
version: develop
|
version: develop
|
||||||
- package: github.com/tendermint/go-events
|
- package: github.com/tendermint/go-events
|
||||||
|
|
|
@ -22,7 +22,7 @@ out the server for test code (mock).
|
||||||
*/
|
*/
|
||||||
type HTTP struct {
|
type HTTP struct {
|
||||||
remote string
|
remote string
|
||||||
rpc *rpcclient.ClientJSONRPC
|
rpc *rpcclient.JSONRPCClient
|
||||||
*WSEvents
|
*WSEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ type HTTP struct {
|
||||||
// and the websocket path (which always seems to be "/websocket")
|
// and the websocket path (which always seems to be "/websocket")
|
||||||
func NewHTTP(remote, wsEndpoint string) *HTTP {
|
func NewHTTP(remote, wsEndpoint string) *HTTP {
|
||||||
return &HTTP{
|
return &HTTP{
|
||||||
rpc: rpcclient.NewClientJSONRPC(remote),
|
rpc: rpcclient.NewJSONRPCClient(remote),
|
||||||
remote: remote,
|
remote: remote,
|
||||||
WSEvents: newWSEvents(remote, wsEndpoint),
|
WSEvents: newWSEvents(remote, wsEndpoint),
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func (c *HTTP) _assertIsEventSwitch() types.EventSwitch {
|
||||||
|
|
||||||
func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
|
func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("status", []interface{}{}, tmResult)
|
_, err := c.rpc.Call("status", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Status")
|
return nil, errors.Wrap(err, "Status")
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (c *HTTP) Status() (*ctypes.ResultStatus, error) {
|
||||||
|
|
||||||
func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("abci_info", []interface{}{}, tmResult)
|
_, err := c.rpc.Call("abci_info", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "ABCIInfo")
|
return nil, errors.Wrap(err, "ABCIInfo")
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,9 @@ func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
||||||
|
|
||||||
func (c *HTTP) ABCIQuery(path string, data []byte, prove bool) (*ctypes.ResultABCIQuery, error) {
|
func (c *HTTP) ABCIQuery(path string, data []byte, prove bool) (*ctypes.ResultABCIQuery, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("abci_query", []interface{}{path, data, prove}, tmResult)
|
_, err := c.rpc.Call("abci_query",
|
||||||
|
map[string]interface{}{"path": path, "data": data, "prove": prove},
|
||||||
|
tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "ABCIQuery")
|
return nil, errors.Wrap(err, "ABCIQuery")
|
||||||
}
|
}
|
||||||
|
@ -78,7 +80,7 @@ func (c *HTTP) ABCIQuery(path string, data []byte, prove bool) (*ctypes.ResultAB
|
||||||
|
|
||||||
func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("broadcast_tx_commit", []interface{}{tx}, tmResult)
|
_, err := c.rpc.Call("broadcast_tx_commit", map[string]interface{}{"tx": tx}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "broadcast_tx_commit")
|
return nil, errors.Wrap(err, "broadcast_tx_commit")
|
||||||
}
|
}
|
||||||
|
@ -95,7 +97,7 @@ func (c *HTTP) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||||
|
|
||||||
func (c *HTTP) broadcastTX(route string, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
func (c *HTTP) broadcastTX(route string, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call(route, []interface{}{tx}, tmResult)
|
_, err := c.rpc.Call(route, map[string]interface{}{"tx": tx}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, route)
|
return nil, errors.Wrap(err, route)
|
||||||
}
|
}
|
||||||
|
@ -104,7 +106,7 @@ func (c *HTTP) broadcastTX(route string, tx types.Tx) (*ctypes.ResultBroadcastTx
|
||||||
|
|
||||||
func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error) {
|
func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("net_info", nil, tmResult)
|
_, err := c.rpc.Call("net_info", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "NetInfo")
|
return nil, errors.Wrap(err, "NetInfo")
|
||||||
}
|
}
|
||||||
|
@ -113,7 +115,7 @@ func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error) {
|
||||||
|
|
||||||
func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("dump_consensus_state", nil, tmResult)
|
_, err := c.rpc.Call("dump_consensus_state", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "DumpConsensusState")
|
return nil, errors.Wrap(err, "DumpConsensusState")
|
||||||
}
|
}
|
||||||
|
@ -122,7 +124,9 @@ func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
||||||
|
|
||||||
func (c *HTTP) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
|
func (c *HTTP) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("blockchain", []interface{}{minHeight, maxHeight}, tmResult)
|
_, err := c.rpc.Call("blockchain",
|
||||||
|
map[string]interface{}{"minHeight": minHeight, "maxHeight": maxHeight},
|
||||||
|
tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "BlockchainInfo")
|
return nil, errors.Wrap(err, "BlockchainInfo")
|
||||||
}
|
}
|
||||||
|
@ -131,7 +135,7 @@ func (c *HTTP) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchai
|
||||||
|
|
||||||
func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error) {
|
func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("genesis", nil, tmResult)
|
_, err := c.rpc.Call("genesis", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Genesis")
|
return nil, errors.Wrap(err, "Genesis")
|
||||||
}
|
}
|
||||||
|
@ -140,7 +144,7 @@ func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error) {
|
||||||
|
|
||||||
func (c *HTTP) Block(height int) (*ctypes.ResultBlock, error) {
|
func (c *HTTP) Block(height int) (*ctypes.ResultBlock, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("block", []interface{}{height}, tmResult)
|
_, err := c.rpc.Call("block", map[string]interface{}{"height": height}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Block")
|
return nil, errors.Wrap(err, "Block")
|
||||||
}
|
}
|
||||||
|
@ -149,7 +153,7 @@ func (c *HTTP) Block(height int) (*ctypes.ResultBlock, error) {
|
||||||
|
|
||||||
func (c *HTTP) Commit(height int) (*ctypes.ResultCommit, error) {
|
func (c *HTTP) Commit(height int) (*ctypes.ResultCommit, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("commit", []interface{}{height}, tmResult)
|
_, err := c.rpc.Call("commit", map[string]interface{}{"height": height}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Commit")
|
return nil, errors.Wrap(err, "Commit")
|
||||||
}
|
}
|
||||||
|
@ -158,7 +162,7 @@ func (c *HTTP) Commit(height int) (*ctypes.ResultCommit, error) {
|
||||||
|
|
||||||
func (c *HTTP) Validators() (*ctypes.ResultValidators, error) {
|
func (c *HTTP) Validators() (*ctypes.ResultValidators, error) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := c.rpc.Call("validators", nil, tmResult)
|
_, err := c.rpc.Call("validators", map[string]interface{}{}, tmResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Validators")
|
return nil, errors.Wrap(err, "Validators")
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
abci "github.com/tendermint/abci/types"
|
abci "github.com/tendermint/abci/types"
|
||||||
. "github.com/tendermint/go-common"
|
. "github.com/tendermint/go-common"
|
||||||
|
rpc "github.com/tendermint/go-rpc/client"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
@ -25,24 +26,20 @@ import (
|
||||||
// status
|
// status
|
||||||
|
|
||||||
func TestURIStatus(t *testing.T) {
|
func TestURIStatus(t *testing.T) {
|
||||||
tmResult := new(ctypes.TMResult)
|
testStatus(t, GetURIClient())
|
||||||
_, err := GetURIClient().Call("status", map[string]interface{}{}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testStatus(t, tmResult)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJSONStatus(t *testing.T) {
|
func TestJSONStatus(t *testing.T) {
|
||||||
tmResult := new(ctypes.TMResult)
|
testStatus(t, GetJSONClient())
|
||||||
_, err := GetJSONClient().Call("status", []interface{}{}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testStatus(t, tmResult)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testStatus(t *testing.T, statusI interface{}) {
|
func testStatus(t *testing.T, client rpc.HTTPClient) {
|
||||||
chainID := GetConfig().GetString("chain_id")
|
chainID := GetConfig().GetString("chain_id")
|
||||||
|
tmResult := new(ctypes.TMResult)
|
||||||
|
_, err := client.Call("status", map[string]interface{}{}, tmResult)
|
||||||
|
require.Nil(t, err)
|
||||||
|
|
||||||
tmRes := statusI.(*ctypes.TMResult)
|
status := (*tmResult).(*ctypes.ResultStatus)
|
||||||
status := (*tmRes).(*ctypes.ResultStatus)
|
|
||||||
assert.Equal(t, chainID, status.NodeInfo.Network)
|
assert.Equal(t, chainID, status.NodeInfo.Network)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,28 +56,22 @@ func randBytes(t *testing.T) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestURIBroadcastTxSync(t *testing.T) {
|
func TestURIBroadcastTxSync(t *testing.T) {
|
||||||
config.Set("block_size", 0)
|
testBroadcastTxSync(t, GetURIClient())
|
||||||
defer config.Set("block_size", -1)
|
|
||||||
tmResult := new(ctypes.TMResult)
|
|
||||||
tx := randBytes(t)
|
|
||||||
_, err := GetURIClient().Call("broadcast_tx_sync", map[string]interface{}{"tx": tx}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testBroadcastTxSync(t, tmResult, tx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJSONBroadcastTxSync(t *testing.T) {
|
func TestJSONBroadcastTxSync(t *testing.T) {
|
||||||
|
testBroadcastTxSync(t, GetJSONClient())
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBroadcastTxSync(t *testing.T, client rpc.HTTPClient) {
|
||||||
config.Set("block_size", 0)
|
config.Set("block_size", 0)
|
||||||
defer config.Set("block_size", -1)
|
defer config.Set("block_size", -1)
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
tx := randBytes(t)
|
tx := randBytes(t)
|
||||||
_, err := GetJSONClient().Call("broadcast_tx_sync", []interface{}{tx}, tmResult)
|
_, err := client.Call("broadcast_tx_sync", map[string]interface{}{"tx": tx}, tmResult)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
testBroadcastTxSync(t, tmResult, tx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testBroadcastTxSync(t *testing.T, resI interface{}, tx []byte) {
|
res := (*tmResult).(*ctypes.ResultBroadcastTx)
|
||||||
tmRes := resI.(*ctypes.TMResult)
|
|
||||||
res := (*tmRes).(*ctypes.ResultBroadcastTx)
|
|
||||||
require.Equal(t, abci.CodeType_OK, res.Code)
|
require.Equal(t, abci.CodeType_OK, res.Code)
|
||||||
mem := node.MempoolReactor().Mempool
|
mem := node.MempoolReactor().Mempool
|
||||||
require.Equal(t, 1, mem.Size())
|
require.Equal(t, 1, mem.Size())
|
||||||
|
@ -98,34 +89,31 @@ func testTxKV(t *testing.T) ([]byte, []byte, []byte) {
|
||||||
return k, v, []byte(Fmt("%s=%s", k, v))
|
return k, v, []byte(Fmt("%s=%s", k, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendTx(t *testing.T) ([]byte, []byte) {
|
func sendTx(t *testing.T, client rpc.HTTPClient) ([]byte, []byte) {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
k, v, tx := testTxKV(t)
|
k, v, tx := testTxKV(t)
|
||||||
_, err := GetJSONClient().Call("broadcast_tx_commit", []interface{}{tx}, tmResult)
|
_, err := client.Call("broadcast_tx_commit", map[string]interface{}{"tx": tx}, tmResult)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
return k, v
|
return k, v
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestURIABCIQuery(t *testing.T) {
|
func TestURIABCIQuery(t *testing.T) {
|
||||||
k, v := sendTx(t)
|
testABCIQuery(t, GetURIClient())
|
||||||
time.Sleep(time.Second)
|
|
||||||
tmResult := new(ctypes.TMResult)
|
|
||||||
_, err := GetURIClient().Call("abci_query", map[string]interface{}{"path": "", "data": k, "prove": false}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testABCIQuery(t, tmResult, v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJSONABCIQuery(t *testing.T) {
|
func TestJSONABCIQuery(t *testing.T) {
|
||||||
k, v := sendTx(t)
|
testABCIQuery(t, GetURIClient())
|
||||||
tmResult := new(ctypes.TMResult)
|
|
||||||
_, err := GetJSONClient().Call("abci_query", []interface{}{"", k, false}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testABCIQuery(t, tmResult, v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testABCIQuery(t *testing.T, statusI interface{}, value []byte) {
|
func testABCIQuery(t *testing.T, client rpc.HTTPClient) {
|
||||||
tmRes := statusI.(*ctypes.TMResult)
|
k, _ := sendTx(t, client)
|
||||||
resQuery := (*tmRes).(*ctypes.ResultABCIQuery)
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
tmResult := new(ctypes.TMResult)
|
||||||
|
_, err := client.Call("abci_query",
|
||||||
|
map[string]interface{}{"path": "", "data": k, "prove": false}, tmResult)
|
||||||
|
require.Nil(t, err)
|
||||||
|
|
||||||
|
resQuery := (*tmResult).(*ctypes.ResultABCIQuery)
|
||||||
require.EqualValues(t, 0, resQuery.Response.Code)
|
require.EqualValues(t, 0, resQuery.Response.Code)
|
||||||
|
|
||||||
// XXX: specific to value returned by the dummy
|
// XXX: specific to value returned by the dummy
|
||||||
|
@ -136,25 +124,22 @@ func testABCIQuery(t *testing.T, statusI interface{}, value []byte) {
|
||||||
// broadcast tx commit
|
// broadcast tx commit
|
||||||
|
|
||||||
func TestURIBroadcastTxCommit(t *testing.T) {
|
func TestURIBroadcastTxCommit(t *testing.T) {
|
||||||
tmResult := new(ctypes.TMResult)
|
testBroadcastTxCommit(t, GetURIClient())
|
||||||
tx := randBytes(t)
|
|
||||||
_, err := GetURIClient().Call("broadcast_tx_commit", map[string]interface{}{"tx": tx}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testBroadcastTxCommit(t, tmResult, tx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJSONBroadcastTxCommit(t *testing.T) {
|
func TestJSONBroadcastTxCommit(t *testing.T) {
|
||||||
tmResult := new(ctypes.TMResult)
|
testBroadcastTxCommit(t, GetJSONClient())
|
||||||
tx := randBytes(t)
|
|
||||||
_, err := GetJSONClient().Call("broadcast_tx_commit", []interface{}{tx}, tmResult)
|
|
||||||
require.Nil(t, err)
|
|
||||||
testBroadcastTxCommit(t, tmResult, tx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBroadcastTxCommit(t *testing.T, resI interface{}, tx []byte) {
|
func testBroadcastTxCommit(t *testing.T, client rpc.HTTPClient) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
tmRes := resI.(*ctypes.TMResult)
|
|
||||||
res := (*tmRes).(*ctypes.ResultBroadcastTxCommit)
|
tmResult := new(ctypes.TMResult)
|
||||||
|
tx := randBytes(t)
|
||||||
|
_, err := client.Call("broadcast_tx_commit", map[string]interface{}{"tx": tx}, tmResult)
|
||||||
|
require.Nil(err)
|
||||||
|
|
||||||
|
res := (*tmResult).(*ctypes.ResultBroadcastTxCommit)
|
||||||
checkTx := res.CheckTx
|
checkTx := res.CheckTx
|
||||||
require.Equal(abci.CodeType_OK, checkTx.Code)
|
require.Equal(abci.CodeType_OK, checkTx.Code)
|
||||||
deliverTx := res.DeliverTx
|
deliverTx := res.DeliverTx
|
||||||
|
@ -240,7 +225,7 @@ func TestWSTxEvent(t *testing.T) {
|
||||||
|
|
||||||
// send an tx
|
// send an tx
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := GetJSONClient().Call("broadcast_tx_sync", []interface{}{tx}, tmResult)
|
_, err := GetJSONClient().Call("broadcast_tx_sync", map[string]interface{}{"tx": tx}, tmResult)
|
||||||
require.Nil(err)
|
require.Nil(err)
|
||||||
|
|
||||||
waitForEvent(t, wsc, eid, true, func() {}, func(eid string, b interface{}) error {
|
waitForEvent(t, wsc, eid, true, func() {}, func(eid string, b interface{}) error {
|
||||||
|
@ -310,7 +295,9 @@ func TestURIUnsafeSetConfig(t *testing.T) {
|
||||||
func TestJSONUnsafeSetConfig(t *testing.T) {
|
func TestJSONUnsafeSetConfig(t *testing.T) {
|
||||||
for _, testCase := range testCasesUnsafeSetConfig {
|
for _, testCase := range testCasesUnsafeSetConfig {
|
||||||
tmResult := new(ctypes.TMResult)
|
tmResult := new(ctypes.TMResult)
|
||||||
_, err := GetJSONClient().Call("unsafe_set_config", []interface{}{testCase[0], testCase[1], testCase[2]}, tmResult)
|
_, err := GetJSONClient().Call("unsafe_set_config",
|
||||||
|
map[string]interface{}{"type": testCase[0], "key": testCase[1], "value": testCase[2]},
|
||||||
|
tmResult)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
}
|
}
|
||||||
testUnsafeSetConfig(t)
|
testUnsafeSetConfig(t)
|
||||||
|
|
|
@ -72,15 +72,15 @@ func GetConfig() cfg.Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetURIClient gets a uri client pointing to the test tendermint rpc
|
// GetURIClient gets a uri client pointing to the test tendermint rpc
|
||||||
func GetURIClient() *client.ClientURI {
|
func GetURIClient() *client.URIClient {
|
||||||
rpcAddr := GetConfig().GetString("rpc_laddr")
|
rpcAddr := GetConfig().GetString("rpc_laddr")
|
||||||
return client.NewClientURI(rpcAddr)
|
return client.NewURIClient(rpcAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetJSONClient gets a http/json client pointing to the test tendermint rpc
|
// GetJSONClient gets a http/json client pointing to the test tendermint rpc
|
||||||
func GetJSONClient() *client.ClientJSONRPC {
|
func GetJSONClient() *client.JSONRPCClient {
|
||||||
rpcAddr := GetConfig().GetString("rpc_laddr")
|
rpcAddr := GetConfig().GetString("rpc_laddr")
|
||||||
return client.NewClientJSONRPC(rpcAddr)
|
return client.NewJSONRPCClient(rpcAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGRPCClient() core_grpc.BroadcastAPIClient {
|
func GetGRPCClient() core_grpc.BroadcastAPIClient {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
go get github.com/tendermint/abci/...
|
go get -d github.com/tendermint/abci
|
||||||
|
|
||||||
# get the abci commit used by tendermint
|
# get the abci commit used by tendermint
|
||||||
COMMIT=`bash scripts/glide/parse.sh abci`
|
COMMIT=`bash scripts/glide/parse.sh abci`
|
||||||
|
|
Loading…
Reference in New Issue