|
@ -7,6 +7,7 @@ import ( |
|
|
"math/rand" |
|
|
"math/rand" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
tmrand "github.com/tendermint/tendermint/libs/rand" |
|
|
rpchttp "github.com/tendermint/tendermint/rpc/client/http" |
|
|
rpchttp "github.com/tendermint/tendermint/rpc/client/http" |
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg" |
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg" |
|
|
"github.com/tendermint/tendermint/types" |
|
|
"github.com/tendermint/tendermint/types" |
|
@ -85,7 +86,7 @@ func Load(ctx context.Context, r *rand.Rand, testnet *e2e.Testnet) error { |
|
|
// generation is primarily the result of backpressure from the
|
|
|
// generation is primarily the result of backpressure from the
|
|
|
// broadcast transaction, though there is still some timer-based
|
|
|
// broadcast transaction, though there is still some timer-based
|
|
|
// limiting.
|
|
|
// limiting.
|
|
|
func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSize int64, networkSize int) { |
|
|
|
|
|
|
|
|
func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSize int, networkSize int) { |
|
|
timer := time.NewTimer(0) |
|
|
timer := time.NewTimer(0) |
|
|
defer timer.Stop() |
|
|
defer timer.Stop() |
|
|
defer close(chTx) |
|
|
defer close(chTx) |
|
@ -101,12 +102,7 @@ func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSiz |
|
|
// space, while reduce the size of the data in the app.
|
|
|
// space, while reduce the size of the data in the app.
|
|
|
id := r.Int63n(100) |
|
|
id := r.Int63n(100) |
|
|
|
|
|
|
|
|
bz := make([]byte, txSize) |
|
|
|
|
|
_, err := r.Read(bz) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
panic(fmt.Errorf("failed to read random bytes: %w", err)) |
|
|
|
|
|
} |
|
|
|
|
|
tx := types.Tx(fmt.Sprintf("load-%X=%x", id, bz)) |
|
|
|
|
|
|
|
|
tx := types.Tx(fmt.Sprintf("load-%X=%s", id, tmrand.StrFromSource(r, txSize))) |
|
|
|
|
|
|
|
|
select { |
|
|
select { |
|
|
case <-ctx.Done(): |
|
|
case <-ctx.Done(): |
|
|