mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
parent
44dad6d70b
commit
8ce588d984
@ -98,6 +98,6 @@ Each route is available as a GET request, as a JSONRPCv2 POST request, and via J
|
|||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
* [Tendermint](https://github.com/tendermint/tendermint/blob/master/rpc/core/routes.go)
|
* [Tendermint](https://github.com/tendermint/tendermint/blob/master/rpc/core/routes.go)
|
||||||
* [tm-monitor](https://github.com/tendermint/tools/blob/master/tm-monitor/rpc.go)
|
* [tm-monitor](https://github.com/tendermint/tendermint/blob/master/tools/tm-monitor/rpc.go)
|
||||||
*/
|
*/
|
||||||
package rpc
|
package rpc
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
FROM golang:latest
|
FROM golang:latest
|
||||||
|
|
||||||
RUN mkdir -p /go/src/github.com/tendermint/tools/tm-bench
|
RUN mkdir -p /go/src/github.com/tendermint/tendermint/tools/tm-bench
|
||||||
WORKDIR /go/src/github.com/tendermint/tools/tm-bench
|
WORKDIR /go/src/github.com/tendermint/tendermint/tools/tm-bench
|
||||||
|
|
||||||
COPY Makefile /go/src/github.com/tendermint/tools/tm-bench/
|
COPY Makefile /go/src/github.com/tendermint/tendermint/tools/tm-bench/
|
||||||
|
|
||||||
RUN make get_tools
|
RUN make get_tools
|
||||||
|
|
||||||
COPY . /go/src/github.com/tendermint/tools/tm-bench
|
COPY . /go/src/github.com/tendermint/tendermint/tools/tm-bench
|
||||||
|
|
||||||
RUN make get_vendor_deps
|
RUN make get_vendor_deps
|
||||||
|
58
tools/tm-bench/Gopkg.lock
generated
58
tools/tm-bench/Gopkg.lock
generated
@ -11,7 +11,7 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/btcsuite/btcd"
|
name = "github.com/btcsuite/btcd"
|
||||||
packages = ["btcec"]
|
packages = ["btcec"]
|
||||||
revision = "675abc5df3c5531bc741b56a765e35623459da6d"
|
revision = "fdfc19097e7ac6b57035062056f5b7b4638b8898"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/davecgh/go-spew"
|
name = "github.com/davecgh/go-spew"
|
||||||
@ -80,7 +80,7 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/golang/snappy"
|
name = "github.com/golang/snappy"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "553a641470496b2327abcac10b36396bd98e45c9"
|
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/gorilla/websocket"
|
name = "github.com/gorilla/websocket"
|
||||||
@ -113,13 +113,13 @@
|
|||||||
version = "v0.8.0"
|
version = "v0.8.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
name = "github.com/prometheus/client_golang"
|
name = "github.com/prometheus/client_golang"
|
||||||
packages = [
|
packages = [
|
||||||
"prometheus",
|
"prometheus",
|
||||||
"prometheus/promhttp"
|
"prometheus/promhttp"
|
||||||
]
|
]
|
||||||
revision = "c5b7fccd204277076155f10851dad72b76a49317"
|
revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632"
|
||||||
version = "v0.8.0"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -146,7 +146,7 @@
|
|||||||
"nfs",
|
"nfs",
|
||||||
"xfs"
|
"xfs"
|
||||||
]
|
]
|
||||||
revision = "7d6f385de8bea29190f15ba9931442a0eaef9af7"
|
revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -171,7 +171,7 @@
|
|||||||
"leveldb/table",
|
"leveldb/table",
|
||||||
"leveldb/util"
|
"leveldb/util"
|
||||||
]
|
]
|
||||||
revision = "ae970a0732be3a1f5311da86118d37b9f4bd2a5a"
|
revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -190,6 +190,7 @@
|
|||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
branch = "develop"
|
||||||
name = "github.com/tendermint/tendermint"
|
name = "github.com/tendermint/tendermint"
|
||||||
packages = [
|
packages = [
|
||||||
"abci/client",
|
"abci/client",
|
||||||
@ -201,9 +202,16 @@
|
|||||||
"consensus",
|
"consensus",
|
||||||
"consensus/types",
|
"consensus/types",
|
||||||
"crypto",
|
"crypto",
|
||||||
|
"crypto/merkle",
|
||||||
"crypto/tmhash",
|
"crypto/tmhash",
|
||||||
"evidence",
|
"evidence",
|
||||||
|
"libs/autofile",
|
||||||
|
"libs/clist",
|
||||||
|
"libs/common",
|
||||||
|
"libs/db",
|
||||||
"libs/events",
|
"libs/events",
|
||||||
|
"libs/flowrate",
|
||||||
|
"libs/log",
|
||||||
"libs/pubsub",
|
"libs/pubsub",
|
||||||
"libs/pubsub/query",
|
"libs/pubsub/query",
|
||||||
"mempool",
|
"mempool",
|
||||||
@ -229,29 +237,14 @@
|
|||||||
"types",
|
"types",
|
||||||
"version"
|
"version"
|
||||||
]
|
]
|
||||||
revision = "aa20c45ae99bb57a8efa2be7b09898e8967d1965"
|
revision = "9d81a74429e093f3167875e0145ad957874c77d1"
|
||||||
version = "v0.21.1-rc1"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "develop"
|
|
||||||
name = "github.com/tendermint/tmlibs"
|
|
||||||
packages = [
|
|
||||||
"autofile",
|
|
||||||
"clist",
|
|
||||||
"common",
|
|
||||||
"db",
|
|
||||||
"flowrate",
|
|
||||||
"log",
|
|
||||||
"merkle",
|
|
||||||
"merkle/tmhash"
|
|
||||||
]
|
|
||||||
revision = "56f44670ebd5a4e99e55f3f7d6f4d360ef5f1973"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "golang.org/x/crypto"
|
name = "golang.org/x/crypto"
|
||||||
packages = [
|
packages = [
|
||||||
"curve25519",
|
"curve25519",
|
||||||
|
"internal/subtle",
|
||||||
"nacl/box",
|
"nacl/box",
|
||||||
"nacl/secretbox",
|
"nacl/secretbox",
|
||||||
"openpgp/armor",
|
"openpgp/armor",
|
||||||
@ -260,7 +253,7 @@
|
|||||||
"ripemd160",
|
"ripemd160",
|
||||||
"salsa20/salsa"
|
"salsa20/salsa"
|
||||||
]
|
]
|
||||||
revision = "1f94bef427e370e425e55b172f3b5e300ef38304"
|
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -272,11 +265,10 @@
|
|||||||
"http2/hpack",
|
"http2/hpack",
|
||||||
"idna",
|
"idna",
|
||||||
"internal/timeseries",
|
"internal/timeseries",
|
||||||
"lex/httplex",
|
|
||||||
"netutil",
|
"netutil",
|
||||||
"trace"
|
"trace"
|
||||||
]
|
]
|
||||||
revision = "640f4622ab692b87c2f3a94265e6f579fe38263d"
|
revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "golang.org/x/text"
|
name = "golang.org/x/text"
|
||||||
@ -303,16 +295,20 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "google.golang.org/genproto"
|
name = "google.golang.org/genproto"
|
||||||
packages = ["googleapis/rpc/status"]
|
packages = ["googleapis/rpc/status"]
|
||||||
revision = "86e600f69ee4704c6efbf6a2a40a5c10700e76c2"
|
revision = "e92b116572682a5b432ddd840aeaba2a559eeff1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "google.golang.org/grpc"
|
name = "google.golang.org/grpc"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"balancer",
|
"balancer",
|
||||||
|
"balancer/base",
|
||||||
|
"balancer/roundrobin",
|
||||||
"codes",
|
"codes",
|
||||||
"connectivity",
|
"connectivity",
|
||||||
"credentials",
|
"credentials",
|
||||||
|
"encoding",
|
||||||
|
"encoding/proto",
|
||||||
"grpclb/grpc_lb_v1/messages",
|
"grpclb/grpc_lb_v1/messages",
|
||||||
"grpclog",
|
"grpclog",
|
||||||
"internal",
|
"internal",
|
||||||
@ -321,17 +317,19 @@
|
|||||||
"naming",
|
"naming",
|
||||||
"peer",
|
"peer",
|
||||||
"resolver",
|
"resolver",
|
||||||
|
"resolver/dns",
|
||||||
|
"resolver/passthrough",
|
||||||
"stats",
|
"stats",
|
||||||
"status",
|
"status",
|
||||||
"tap",
|
"tap",
|
||||||
"transport"
|
"transport"
|
||||||
]
|
]
|
||||||
revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e"
|
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
|
||||||
version = "v1.7.5"
|
version = "v1.11.3"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "65c380641dcebca21a6343c9ea36bab5cbebff696e27c74d0735077f63272248"
|
inputs-digest = "bc54a74ffdfc09872726fcf5c72b5df882269dc1cd949ac3fbeac9a554fc25c6"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -45,10 +45,6 @@
|
|||||||
name = "github.com/tendermint/tendermint"
|
name = "github.com/tendermint/tendermint"
|
||||||
branch = "develop"
|
branch = "develop"
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/tendermint/tmlibs"
|
|
||||||
branch = "develop"
|
|
||||||
|
|
||||||
[prune]
|
[prune]
|
||||||
go-tests = true
|
go-tests = true
|
||||||
unused-packages = true
|
unused-packages = true
|
||||||
|
@ -12,13 +12,11 @@ import (
|
|||||||
|
|
||||||
"github.com/go-kit/kit/log/term"
|
"github.com/go-kit/kit/log/term"
|
||||||
metrics "github.com/rcrowley/go-metrics"
|
metrics "github.com/rcrowley/go-metrics"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
tmrpc "github.com/tendermint/tendermint/rpc/client"
|
tmrpc "github.com/tendermint/tendermint/rpc/client"
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "0.3.0"
|
|
||||||
|
|
||||||
var logger = log.NewNopLogger()
|
var logger = log.NewNopLogger()
|
||||||
|
|
||||||
type statistics struct {
|
type statistics struct {
|
||||||
@ -106,35 +104,32 @@ Examples:
|
|||||||
"broadcast_tx_"+broadcastTxMethod,
|
"broadcast_tx_"+broadcastTxMethod,
|
||||||
)
|
)
|
||||||
endTime := time.Duration(duration) * time.Second
|
endTime := time.Duration(duration) * time.Second
|
||||||
select {
|
|
||||||
case <-time.After(endTime):
|
<-time.After(endTime)
|
||||||
for i, t := range transacters {
|
for i, t := range transacters {
|
||||||
t.Stop()
|
t.Stop()
|
||||||
numCrashes := countCrashes(t.connsBroken)
|
numCrashes := countCrashes(t.connsBroken)
|
||||||
if numCrashes != 0 {
|
if numCrashes != 0 {
|
||||||
fmt.Printf("%d connections crashed on transacter #%d\n", numCrashes, i)
|
fmt.Printf("%d connections crashed on transacter #%d\n", numCrashes, i)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timeStop := time.Now()
|
|
||||||
logger.Info("Time stopped", "t", timeStop)
|
|
||||||
|
|
||||||
stats, err := calculateStatistics(
|
|
||||||
client,
|
|
||||||
initialHeight,
|
|
||||||
timeStart,
|
|
||||||
timeStop,
|
|
||||||
duration,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintln(os.Stderr, err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
printStatistics(stats, outputFormat)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeStop := time.Now()
|
||||||
|
logger.Info("Time stopped", "t", timeStop)
|
||||||
|
|
||||||
|
stats, err := calculateStatistics(
|
||||||
|
client,
|
||||||
|
initialHeight,
|
||||||
|
timeStart,
|
||||||
|
timeStop,
|
||||||
|
duration,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
printStatistics(stats, outputFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
func latestBlockHeight(client tmrpc.Client) int64 {
|
func latestBlockHeight(client tmrpc.Client) int64 {
|
||||||
|
@ -16,14 +16,14 @@ import (
|
|||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
rpctypes "github.com/tendermint/tendermint/rpc/lib/types"
|
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
rpctypes "github.com/tendermint/tendermint/rpc/lib/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sendTimeout = 10 * time.Second
|
sendTimeout = 10 * time.Second
|
||||||
// see https://github.com/tendermint/go-rpc/blob/develop/server/handlers.go#L313
|
// see https://github.com/tendermint/tendermint/blob/master/rpc/lib/server/handlers.go
|
||||||
pingPeriod = (30 * 9 / 10) * time.Second
|
pingPeriod = (30 * 9 / 10) * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ func (t *transacter) sendLoop(connIndex int) {
|
|||||||
txNumber++
|
txNumber++
|
||||||
}
|
}
|
||||||
|
|
||||||
timeToSend := time.Now().Sub(startTime)
|
timeToSend := time.Since(startTime)
|
||||||
logger.Info(fmt.Sprintf("sent %d transactions", numTxSent), "took", timeToSend)
|
logger.Info(fmt.Sprintf("sent %d transactions", numTxSent), "took", timeToSend)
|
||||||
if timeToSend < 1*time.Second {
|
if timeToSend < 1*time.Second {
|
||||||
sleepTime := time.Second - timeToSend
|
sleepTime := time.Second - timeToSend
|
||||||
|
139
tools/tm-monitor/Gopkg.lock
generated
139
tools/tm-monitor/Gopkg.lock
generated
@ -1,11 +1,17 @@
|
|||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||||
|
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/beorn7/perks"
|
||||||
|
packages = ["quantile"]
|
||||||
|
revision = "3a771d992973f24aa725d07868b467d1ddfceafb"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/btcsuite/btcd"
|
name = "github.com/btcsuite/btcd"
|
||||||
packages = ["btcec"]
|
packages = ["btcec"]
|
||||||
revision = "2be2f12b358dc57d70b8f501b00be450192efbc3"
|
revision = "fdfc19097e7ac6b57035062056f5b7b4638b8898"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/davecgh/go-spew"
|
name = "github.com/davecgh/go-spew"
|
||||||
@ -14,7 +20,6 @@
|
|||||||
version = "v1.1.0"
|
version = "v1.1.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
|
||||||
name = "github.com/ebuchman/fail-test"
|
name = "github.com/ebuchman/fail-test"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "95f809107225be108efcf10a3509e4ea6ceef3c4"
|
revision = "95f809107225be108efcf10a3509e4ea6ceef3c4"
|
||||||
@ -24,7 +29,11 @@
|
|||||||
packages = [
|
packages = [
|
||||||
"log",
|
"log",
|
||||||
"log/level",
|
"log/level",
|
||||||
"log/term"
|
"log/term",
|
||||||
|
"metrics",
|
||||||
|
"metrics/discard",
|
||||||
|
"metrics/internal/lv",
|
||||||
|
"metrics/prometheus"
|
||||||
]
|
]
|
||||||
revision = "4dc7be5d2d12881735283bcab7352178e190fc71"
|
revision = "4dc7be5d2d12881735283bcab7352178e190fc71"
|
||||||
version = "v0.6.0"
|
version = "v0.6.0"
|
||||||
@ -70,7 +79,7 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/golang/snappy"
|
name = "github.com/golang/snappy"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "553a641470496b2327abcac10b36396bd98e45c9"
|
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/gorilla/websocket"
|
name = "github.com/gorilla/websocket"
|
||||||
@ -90,6 +99,12 @@
|
|||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
|
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/matttproud/golang_protobuf_extensions"
|
||||||
|
packages = ["pbutil"]
|
||||||
|
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
|
||||||
|
version = "v1.0.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/pkg/errors"
|
name = "github.com/pkg/errors"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
@ -102,11 +117,43 @@
|
|||||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||||
version = "v1.0.0"
|
version = "v1.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/prometheus/client_golang"
|
||||||
|
packages = ["prometheus"]
|
||||||
|
revision = "ae27198cdd90bf12cd134ad79d1366a6cf49f632"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/prometheus/client_model"
|
||||||
|
packages = ["go"]
|
||||||
|
revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/prometheus/common"
|
||||||
|
packages = [
|
||||||
|
"expfmt",
|
||||||
|
"internal/bitbucket.org/ww/goautoneg",
|
||||||
|
"model"
|
||||||
|
]
|
||||||
|
revision = "7600349dcfe1abd18d72d3a1770870d9800a7801"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/prometheus/procfs"
|
||||||
|
packages = [
|
||||||
|
".",
|
||||||
|
"internal/util",
|
||||||
|
"nfs",
|
||||||
|
"xfs"
|
||||||
|
]
|
||||||
|
revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/rcrowley/go-metrics"
|
name = "github.com/rcrowley/go-metrics"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "d932a24a8ccb8fcadc993e5c6c58f93dac168294"
|
revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/stretchr/testify"
|
name = "github.com/stretchr/testify"
|
||||||
@ -114,8 +161,8 @@
|
|||||||
"assert",
|
"assert",
|
||||||
"require"
|
"require"
|
||||||
]
|
]
|
||||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||||
version = "v1.2.1"
|
version = "v1.2.2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -134,18 +181,7 @@
|
|||||||
"leveldb/table",
|
"leveldb/table",
|
||||||
"leveldb/util"
|
"leveldb/util"
|
||||||
]
|
]
|
||||||
revision = "714f901b98fdb3aa954b4193d8cbd64a28d80cad"
|
revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/tendermint/abci"
|
|
||||||
packages = [
|
|
||||||
"client",
|
|
||||||
"example/code",
|
|
||||||
"example/kvstore",
|
|
||||||
"types"
|
|
||||||
]
|
|
||||||
revision = "78a8905690ef54f9d57e3b2b0ee7ad3a04ef3f1f"
|
|
||||||
version = "v0.10.3"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
@ -160,19 +196,27 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/tendermint/go-amino"
|
name = "github.com/tendermint/go-amino"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "42246108ff925a457fb709475070a03dfd3e2b5c"
|
revision = "2106ca61d91029c931fd54968c2bb02dc96b1412"
|
||||||
version = "0.9.6"
|
version = "0.10.1"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/tendermint/go-crypto"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "915416979bf70efa4bcbf1c6cd5d64c5fff9fc19"
|
|
||||||
version = "v0.6.2"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/tendermint/tendermint"
|
name = "github.com/tendermint/tendermint"
|
||||||
packages = [
|
packages = [
|
||||||
|
"abci/client",
|
||||||
|
"abci/example/code",
|
||||||
|
"abci/example/kvstore",
|
||||||
|
"abci/types",
|
||||||
"config",
|
"config",
|
||||||
|
"crypto",
|
||||||
|
"crypto/merkle",
|
||||||
|
"crypto/tmhash",
|
||||||
|
"libs/common",
|
||||||
|
"libs/db",
|
||||||
|
"libs/events",
|
||||||
|
"libs/flowrate",
|
||||||
|
"libs/log",
|
||||||
|
"libs/pubsub",
|
||||||
|
"libs/pubsub/query",
|
||||||
"p2p",
|
"p2p",
|
||||||
"p2p/conn",
|
"p2p/conn",
|
||||||
"p2p/upnp",
|
"p2p/upnp",
|
||||||
@ -184,29 +228,15 @@
|
|||||||
"state",
|
"state",
|
||||||
"types"
|
"types"
|
||||||
]
|
]
|
||||||
revision = "d0beaba7e8a5652506a34b5fab299cc2dc274c02"
|
revision = "2aa2b63cadc42cca1071c36adfd2f2ce14e1aa8f"
|
||||||
version = "v0.19.0"
|
version = "v0.22.3"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/tendermint/tmlibs"
|
|
||||||
packages = [
|
|
||||||
"common",
|
|
||||||
"db",
|
|
||||||
"events",
|
|
||||||
"flowrate",
|
|
||||||
"log",
|
|
||||||
"merkle",
|
|
||||||
"pubsub",
|
|
||||||
"pubsub/query"
|
|
||||||
]
|
|
||||||
revision = "737154202faf75c70437f59ba5303f2eb09f5636"
|
|
||||||
version = "0.8.2-rc1"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "golang.org/x/crypto"
|
name = "golang.org/x/crypto"
|
||||||
packages = [
|
packages = [
|
||||||
"curve25519",
|
"curve25519",
|
||||||
|
"internal/subtle",
|
||||||
"nacl/box",
|
"nacl/box",
|
||||||
"nacl/secretbox",
|
"nacl/secretbox",
|
||||||
"openpgp/armor",
|
"openpgp/armor",
|
||||||
@ -215,10 +245,9 @@
|
|||||||
"ripemd160",
|
"ripemd160",
|
||||||
"salsa20/salsa"
|
"salsa20/salsa"
|
||||||
]
|
]
|
||||||
revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e"
|
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/net"
|
name = "golang.org/x/net"
|
||||||
packages = [
|
packages = [
|
||||||
"context",
|
"context",
|
||||||
@ -227,10 +256,10 @@
|
|||||||
"http2/hpack",
|
"http2/hpack",
|
||||||
"idna",
|
"idna",
|
||||||
"internal/timeseries",
|
"internal/timeseries",
|
||||||
"lex/httplex",
|
"netutil",
|
||||||
"trace"
|
"trace"
|
||||||
]
|
]
|
||||||
revision = "8d16fa6dc9a85c1cd3ed24ad08ff21cf94f10888"
|
revision = "292b43bbf7cb8d35ddf40f8d5100ef3837cced3f"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "golang.org/x/text"
|
name = "golang.org/x/text"
|
||||||
@ -257,16 +286,20 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "google.golang.org/genproto"
|
name = "google.golang.org/genproto"
|
||||||
packages = ["googleapis/rpc/status"]
|
packages = ["googleapis/rpc/status"]
|
||||||
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
|
revision = "e92b116572682a5b432ddd840aeaba2a559eeff1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "google.golang.org/grpc"
|
name = "google.golang.org/grpc"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"balancer",
|
"balancer",
|
||||||
|
"balancer/base",
|
||||||
|
"balancer/roundrobin",
|
||||||
"codes",
|
"codes",
|
||||||
"connectivity",
|
"connectivity",
|
||||||
"credentials",
|
"credentials",
|
||||||
|
"encoding",
|
||||||
|
"encoding/proto",
|
||||||
"grpclb/grpc_lb_v1/messages",
|
"grpclb/grpc_lb_v1/messages",
|
||||||
"grpclog",
|
"grpclog",
|
||||||
"internal",
|
"internal",
|
||||||
@ -275,17 +308,19 @@
|
|||||||
"naming",
|
"naming",
|
||||||
"peer",
|
"peer",
|
||||||
"resolver",
|
"resolver",
|
||||||
|
"resolver/dns",
|
||||||
|
"resolver/passthrough",
|
||||||
"stats",
|
"stats",
|
||||||
"status",
|
"status",
|
||||||
"tap",
|
"tap",
|
||||||
"transport"
|
"transport"
|
||||||
]
|
]
|
||||||
revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e"
|
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
|
||||||
version = "v1.7.5"
|
version = "v1.11.3"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "c445a659655eae3fbc1355e7d3431aa7f4b78f2f052ecba723cf8dcefd6350c4"
|
inputs-digest = "b8644e2f33b8c04ed76a9cda1b6d7741a0e36844fdb0ce0d68717332779bcd75"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -37,21 +37,13 @@
|
|||||||
name = "github.com/stretchr/testify"
|
name = "github.com/stretchr/testify"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/tendermint/go-crypto"
|
|
||||||
version = "~0.6.2"
|
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/tendermint/go-amino"
|
name = "github.com/tendermint/go-amino"
|
||||||
version = "~0.9.6"
|
version = "~0.10.1"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/tendermint/tendermint"
|
name = "github.com/tendermint/tendermint"
|
||||||
version = "0.19.0"
|
version = "v0.22.3"
|
||||||
|
|
||||||
[[override]]
|
|
||||||
name = "github.com/tendermint/tmlibs"
|
|
||||||
version = "~0.8.2-rc1"
|
|
||||||
|
|
||||||
[prune]
|
[prune]
|
||||||
go-tests = true
|
go-tests = true
|
||||||
|
@ -9,9 +9,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
metrics "github.com/rcrowley/go-metrics"
|
metrics "github.com/rcrowley/go-metrics"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/libs/events"
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
client "github.com/tendermint/tendermint/rpc/lib/client"
|
client "github.com/tendermint/tendermint/rpc/lib/client"
|
||||||
"github.com/tendermint/tmlibs/events"
|
|
||||||
"github.com/tendermint/tmlibs/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -162,11 +163,8 @@ func (em *EventMeter) Subscribe(query string, cb EventCallbackFunc) error {
|
|||||||
func (em *EventMeter) Unsubscribe(query string) error {
|
func (em *EventMeter) Unsubscribe(query string) error {
|
||||||
em.mtx.Lock()
|
em.mtx.Lock()
|
||||||
defer em.mtx.Unlock()
|
defer em.mtx.Unlock()
|
||||||
if err := em.wsc.Unsubscribe(context.TODO(), query); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return em.wsc.Unsubscribe(context.TODO(), query)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMetric fills in the latest data for an query and return a copy.
|
// GetMetric fills in the latest data for an query and return a copy.
|
||||||
|
@ -6,13 +6,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
cmn "github.com/tendermint/tmlibs/common"
|
cmn "github.com/tendermint/tendermint/libs/common"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "0.4.0"
|
|
||||||
|
|
||||||
var logger = log.NewNopLogger()
|
var logger = log.NewNopLogger()
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -4,9 +4,9 @@ import (
|
|||||||
stdlog "log"
|
stdlog "log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/tendermint/tmlibs/log"
|
|
||||||
em "github.com/tendermint/tools/tm-monitor/eventmeter"
|
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
em "github.com/tendermint/tendermint/tools/tm-monitor/eventmeter"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EventMeter struct {
|
type EventMeter struct {
|
||||||
@ -44,7 +44,7 @@ func (e *EventMeter) Call(callback string, args ...interface{}) {
|
|||||||
|
|
||||||
type RpcClient struct {
|
type RpcClient struct {
|
||||||
Stubs map[string]interface{}
|
Stubs map[string]interface{}
|
||||||
cdc *amino.Codec
|
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) {
|
||||||
@ -66,4 +66,4 @@ func (c *RpcClient) Codec() *amino.Codec {
|
|||||||
|
|
||||||
func (c *RpcClient) SetCodec(cdc *amino.Codec) {
|
func (c *RpcClient) SetCodec(cdc *amino.Codec) {
|
||||||
c.cdc = cdc
|
c.cdc = cdc
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
"github.com/tendermint/tmlibs/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// waiting more than this many seconds for a block means we're unhealthy
|
// waiting more than this many seconds for a block means we're unhealthy
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
|
||||||
mock "github.com/tendermint/tools/tm-monitor/mock"
|
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
|
crypto "github.com/tendermint/tendermint/crypto"
|
||||||
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
|
mock "github.com/tendermint/tendermint/tools/tm-monitor/mock"
|
||||||
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMonitorUpdatesNumberOfValidators(t *testing.T) {
|
func TestMonitorUpdatesNumberOfValidators(t *testing.T) {
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkNewBlock(t *testing.T) {
|
func TestNetworkNewBlock(t *testing.T) {
|
||||||
|
@ -6,13 +6,14 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
crypto "github.com/tendermint/go-crypto"
|
|
||||||
|
crypto "github.com/tendermint/tendermint/crypto"
|
||||||
|
"github.com/tendermint/tendermint/libs/events"
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
rpc_client "github.com/tendermint/tendermint/rpc/lib/client"
|
rpc_client "github.com/tendermint/tendermint/rpc/lib/client"
|
||||||
|
em "github.com/tendermint/tendermint/tools/tm-monitor/eventmeter"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
"github.com/tendermint/tmlibs/events"
|
|
||||||
"github.com/tendermint/tmlibs/log"
|
|
||||||
em "github.com/tendermint/tools/tm-monitor/eventmeter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxRestarts = 25
|
const maxRestarts = 25
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
|
||||||
em "github.com/tendermint/tools/tm-monitor/eventmeter"
|
|
||||||
mock "github.com/tendermint/tools/tm-monitor/mock"
|
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
|
crypto "github.com/tendermint/tendermint/crypto"
|
||||||
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
|
em "github.com/tendermint/tendermint/tools/tm-monitor/eventmeter"
|
||||||
|
mock "github.com/tendermint/tendermint/tools/tm-monitor/mock"
|
||||||
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -4,9 +4,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
rpc "github.com/tendermint/tendermint/rpc/lib/server"
|
rpc "github.com/tendermint/tendermint/rpc/lib/server"
|
||||||
"github.com/tendermint/tmlibs/log"
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func startRPC(listenAddr string, m *monitor.Monitor, logger log.Logger) {
|
func startRPC(listenAddr string, m *monitor.Monitor, logger log.Logger) {
|
||||||
@ -16,7 +16,7 @@ func startRPC(listenAddr string, m *monitor.Monitor, logger log.Logger) {
|
|||||||
wm := rpc.NewWebsocketManager(routes, nil)
|
wm := rpc.NewWebsocketManager(routes, nil)
|
||||||
mux.HandleFunc("/websocket", wm.WebsocketHandler)
|
mux.HandleFunc("/websocket", wm.WebsocketHandler)
|
||||||
rpc.RegisterRPCFuncs(mux, routes, cdc, logger)
|
rpc.RegisterRPCFuncs(mux, routes, cdc, logger)
|
||||||
if _, err := rpc.StartHTTPServer(listenAddr, mux, logger); err != nil {
|
if _, err := rpc.StartHTTPServer(listenAddr, mux, logger, rpc.Config{}); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
monitor "github.com/tendermint/tools/tm-monitor/monitor"
|
monitor "github.com/tendermint/tendermint/tools/tm-monitor/monitor"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1,140 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/rand"
|
|
||||||
"encoding/binary"
|
|
||||||
"encoding/hex"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/tendermint/go-rpc/client"
|
|
||||||
rpctypes "github.com/tendermint/go-rpc/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
args := flag.Args()
|
|
||||||
if len(args) < 2 {
|
|
||||||
fmt.Println("transact.go expects at least two arguments (ntxs, hosts)")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
nTxS, hostS := args[0], args[1]
|
|
||||||
nTxs, err := strconv.Atoi(nTxS)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("ntxs must be an integer:", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
hosts := strings.Split(hostS, ",")
|
|
||||||
|
|
||||||
errCh := make(chan error, 1000)
|
|
||||||
|
|
||||||
wg := new(sync.WaitGroup)
|
|
||||||
wg.Add(len(hosts))
|
|
||||||
start := time.Now()
|
|
||||||
fmt.Printf("Sending %d txs on every host %v\n", nTxs, hosts)
|
|
||||||
for i, host := range hosts {
|
|
||||||
go broadcastTxsToHost(wg, errCh, i, host, nTxs, 0)
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
fmt.Println("Done broadcasting txs. Took", time.Since(start))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func broadcastTxsToHost(wg *sync.WaitGroup, errCh chan error, valI int, valHost string, nTxs int, txCount int) {
|
|
||||||
reconnectSleepSeconds := time.Second * 1
|
|
||||||
|
|
||||||
// thisStart := time.Now()
|
|
||||||
// cli := rpcclient.NewClientURI(valHost + ":26657")
|
|
||||||
fmt.Println("Connecting to host to broadcast txs", valI, valHost)
|
|
||||||
cli := rpcclient.NewWSClient(valHost, "/websocket")
|
|
||||||
if _, err := cli.Start(); err != nil {
|
|
||||||
if nTxs == 0 {
|
|
||||||
time.Sleep(reconnectSleepSeconds)
|
|
||||||
broadcastTxsToHost(wg, errCh, valI, valHost, nTxs, txCount)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fmt.Printf("Error starting websocket connection to val%d (%s): %v\n", valI, valHost, err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
reconnect := make(chan struct{})
|
|
||||||
go func(count int) {
|
|
||||||
LOOP:
|
|
||||||
for {
|
|
||||||
ticker := time.NewTicker(reconnectSleepSeconds)
|
|
||||||
select {
|
|
||||||
case <-cli.ResultsCh:
|
|
||||||
count += 1
|
|
||||||
// nTxs == 0 means just loop forever
|
|
||||||
if nTxs > 0 && count == nTxs {
|
|
||||||
break LOOP
|
|
||||||
}
|
|
||||||
case err := <-cli.ErrorsCh:
|
|
||||||
fmt.Println("err: val", valI, valHost, err)
|
|
||||||
case <-cli.Quit:
|
|
||||||
broadcastTxsToHost(wg, errCh, valI, valHost, nTxs, count)
|
|
||||||
return
|
|
||||||
case <-reconnect:
|
|
||||||
broadcastTxsToHost(wg, errCh, valI, valHost, nTxs, count)
|
|
||||||
return
|
|
||||||
case <-ticker.C:
|
|
||||||
if nTxs == 0 {
|
|
||||||
cli.Stop()
|
|
||||||
broadcastTxsToHost(wg, errCh, valI, valHost, nTxs, count)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("Received all responses from node %d (%s)\n", valI, valHost)
|
|
||||||
wg.Done()
|
|
||||||
}(txCount)
|
|
||||||
var i = 0
|
|
||||||
for {
|
|
||||||
/* if i%(nTxs/4) == 0 {
|
|
||||||
fmt.Printf("Have sent %d txs to node %d. Total time so far: %v\n", i, valI, time.Since(thisStart))
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if !cli.IsRunning() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tx := generateTx(i, valI)
|
|
||||||
if err := cli.WriteJSON(rpctypes.RPCRequest{
|
|
||||||
JSONRPC: "2.0",
|
|
||||||
ID: "",
|
|
||||||
Method: "broadcast_tx_async",
|
|
||||||
Params: []interface{}{hex.EncodeToString(tx)},
|
|
||||||
}); err != nil {
|
|
||||||
fmt.Printf("Error sending tx %d to validator %d: %v. Attempt reconnect\n", i, valI, err)
|
|
||||||
reconnect <- struct{}{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
i += 1
|
|
||||||
if nTxs > 0 && i >= nTxs {
|
|
||||||
break
|
|
||||||
} else if nTxs == 0 {
|
|
||||||
time.Sleep(time.Millisecond * 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("Done sending %d txs to node s%d (%s)\n", nTxs, valI, valHost)
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateTx(i, valI int) []byte {
|
|
||||||
// a tx encodes the validator index, the tx number, and some random junk
|
|
||||||
// TODO: read random bytes into more of the tx
|
|
||||||
tx := make([]byte, 250)
|
|
||||||
binary.PutUvarint(tx[:32], uint64(valI))
|
|
||||||
binary.PutUvarint(tx[32:64], uint64(i))
|
|
||||||
if _, err := rand.Read(tx[234:]); err != nil {
|
|
||||||
fmt.Println("err reading from crypto/rand", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return tx
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user