Commit b8e06008 authored by duanjinfei's avatar duanjinfei

change continued send tx

parent 246d11b1
...@@ -22,7 +22,7 @@ func init() { ...@@ -22,7 +22,7 @@ func init() {
startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile") startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile")
startCmd.PersistentFlags().IntVar(&startCount, "startCount", 0, "read excel start count") startCmd.PersistentFlags().IntVar(&startCount, "startCount", 0, "read excel start count")
startCmd.PersistentFlags().IntVar(&endCount, "endCount", 100, "read excel end count") startCmd.PersistentFlags().IntVar(&endCount, "endCount", 100, "read excel end count")
startCmd.PersistentFlags().BoolVar(&broadcastTxArr, "broadcastTxArr", false, "test grpc interface -> broadcastTxArr") startCmd.PersistentFlags().BoolVar(&broadcastTxArr, "broadcastTxArr", true, "test grpc interface -> broadcastTxArr")
startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count") startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count")
startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 10, "send tran goRoutine count") startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 10, "send tran goRoutine count")
startCmd.PersistentFlags().IntVar(&batchCount, "batchCount", 100, "batch send tran count") startCmd.PersistentFlags().IntVar(&batchCount, "batchCount", 100, "batch send tran count")
......
...@@ -50,22 +50,24 @@ func startTest() { ...@@ -50,22 +50,24 @@ func startTest() {
for { for {
arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg) arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg)
tranArrChan <- arr tranArrChan <- arr
updateNonce(syncMap, cfg) syncMap = updateNonce(syncMap, cfg)
} }
} }
} }
func updateNonce(nonceMap sync.Map, cfg *tool.Config) { func updateNonce(nonceMap sync.Map, cfg *tool.Config) sync.Map {
var newNonceMap sync.Map
nonceMap.Range(func(key, value any) bool { nonceMap.Range(func(key, value any) bool {
load, ok := nonceMap.Load(key) load, ok := nonceMap.Load(key)
if !ok { if !ok {
return false return false
} }
nonceMap.Store(key, load.(int)+cfg.SignCount) newNonceMap.Store(key, load.(int)+cfg.SignCount)
load, ok = nonceMap.Load(key) load, ok = newNonceMap.Load(key)
if !ok { if !ok {
return false return false
} }
log.Info("updated addr nonce:", load) log.Info("updated addr nonce:", load)
return true return true
}) })
return newNonceMap
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment