From 8ff658349de473aeb329fd9fc422f0c017c8c551 Mon Sep 17 00:00:00 2001 From: qpwedev Date: Mon, 11 Dec 2023 22:09:54 +0100 Subject: [PATCH] tx burst --- main.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 4aa6e16..69c87d2 100644 --- a/main.go +++ b/main.go @@ -53,14 +53,18 @@ func main() { } // Repeat sending transactions txAmount times. - for txAmount > 0 && txAmount != 0 { - log.Println("Sending transaction") - if err := sendMessage(w, api, client); err != nil { - log.Println("Error sending messages:", err.Error()) + for { + for i := 0; i < 50; i++ { + go func() { + log.Println("Sending transaction") + if err := sendMessage(w, api, client); err != nil { + log.Println("Error sending messages:", err.Error()) + } + log.Println("Sent", txAmount, "transactions") + txAmount -= 1 + }() } - - log.Println("Sent", txAmount, "transactions") - txAmount -= 1 + time.Sleep(4 * time.Second) } }