Browse Source

Fixed rpctypes.Request creation to new format

pull/465/head
Ethan Frey 7 years ago
parent
commit
7ebf011fcd
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      benchmarks/simu/counter.go

+ 8
- 5
benchmarks/simu/counter.go View File

@ -7,11 +7,11 @@ import (
"fmt" "fmt"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
. "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tendermint/rpc/lib/client"
"github.com/tendermint/tendermint/rpc/lib/types"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
_ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types _ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types
"github.com/tendermint/tendermint/rpc/lib/client"
"github.com/tendermint/tendermint/rpc/lib/types"
. "github.com/tendermint/tmlibs/common"
) )
func main() { func main() {
@ -37,13 +37,16 @@ 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",
request, err := rpctypes.MapToRequest("fakeid",
"broadcast_tx", "broadcast_tx",
map[string]interface{}{"tx": buf[:8]}) map[string]interface{}{"tx": buf[:8]})
if err != nil {
Exit(err.Error())
}
reqBytes := wire.JSONBytes(request) reqBytes := wire.JSONBytes(request)
//fmt.Println("!!", string(reqBytes)) //fmt.Println("!!", string(reqBytes))
fmt.Print(".") fmt.Print(".")
err := ws.WriteMessage(websocket.TextMessage, reqBytes)
err = ws.WriteMessage(websocket.TextMessage, reqBytes)
if err != nil { if err != nil {
Exit(err.Error()) Exit(err.Error())
} }


Loading…
Cancel
Save