Commit b8e06008 authored by duanjinfei's avatar duanjinfei

change continued send tx

parent 246d11b1
......@@ -22,7 +22,7 @@ func init() {
startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile")
startCmd.PersistentFlags().IntVar(&startCount, "startCount", 0, "read excel start 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(&goRoutineCount, "goRoutineCount", 10, "send tran goRoutine count")
startCmd.PersistentFlags().IntVar(&batchCount, "batchCount", 100, "batch send tran count")
......
......@@ -50,22 +50,24 @@ func startTest() {
for {
arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg)
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 {
load, ok := nonceMap.Load(key)
if !ok {
return false
}
nonceMap.Store(key, load.(int)+cfg.SignCount)
load, ok = nonceMap.Load(key)
newNonceMap.Store(key, load.(int)+cfg.SignCount)
load, ok = newNonceMap.Load(key)
if !ok {
return false
}
log.Info("updated addr nonce:", load)
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