Commit a30e5589 authored by duanjinfei's avatar duanjinfei

change metatypes tx hash verify

parent 9a898188
...@@ -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().BoolVar(&batchSign, "batchSign", false, "test grpc interface -> batchSign") startCmd.PersistentFlags().BoolVar(&batchSign, "batchSign", false, "test grpc interface -> batchSign")
startCmd.PersistentFlags().BoolVar(&batchRecover, "batchRecover", false, "test grpc interface -> batchRecover") startCmd.PersistentFlags().BoolVar(&batchRecover, "batchRecover", false, "test grpc interface -> batchRecover")
startCmd.PersistentFlags().BoolVar(&batchRecoverTx, "batchRecoverTx", false, "test grpc interface -> batchRecoverTx") startCmd.PersistentFlags().BoolVar(&batchRecoverTx, "batchRecoverTx", true, "test grpc interface -> batchRecoverTx")
startCmd.PersistentFlags().BoolVar(&batchVerify, "batchVerify", false, "test grpc interface -> batchVerify") startCmd.PersistentFlags().BoolVar(&batchVerify, "batchVerify", false, "test grpc interface -> batchVerify")
startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count") startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count")
startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 100, "send tran goRoutine count") startCmd.PersistentFlags().IntVar(&goRoutineCount, "goRoutineCount", 100, "send tran goRoutine count")
......
...@@ -229,11 +229,11 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -229,11 +229,11 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) {
} }
} }
beforeSendTxTime = time.Now() beforeSendTxTime = time.Now()
atomic.AddInt64(&bathHandleSendCount, 1) atomic.AddInt64(&bathHandleSendCount, int64(len(batchRecoverTx.RawTx)))
sinceTime := time.Since(sendTranStartTime).Milliseconds() sinceTime := time.Since(sendTranStartTime).Milliseconds()
atomic.AddInt64(&totalSendTime, sinceTime) atomic.AddInt64(&totalSendTime, sinceTime)
for _, tx := range sign.GetRecoverdTx() { for _, tx := range sign.GetRecoverdTx() {
if set.contain(tx.From) { if set.contain(*tx.From) {
continue continue
} }
set.txArr = append(set.txArr, tx) set.txArr = append(set.txArr, tx)
...@@ -268,10 +268,10 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, fromAddrArr []common.Ad ...@@ -268,10 +268,10 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, fromAddrArr []common.Ad
} }
} }
for { for {
if bathHandleSendCount == allSignedTxCount/int64(cfg.BatchCount) { if bathHandleSendCount == allSignedTxCount {
for _, fromAddr := range fromAddrArr { for _, fromAddr := range fromAddrArr {
address := metatypes.HexToAddress(fromAddr.Hex()) address := metatypes.HexToAddress(fromAddr.Hex())
if !set.contain(&address) { if !set.contain(address) {
log.Error("not contain from addr:", address) log.Error("not contain from addr:", address)
} }
} }
...@@ -311,9 +311,9 @@ func constructionRawTx(tran *types.Transaction) v1.MetaTxBase { ...@@ -311,9 +311,9 @@ func constructionRawTx(tran *types.Transaction) v1.MetaTxBase {
return rawTx return rawTx
} }
func (s *Set) contain(metaBase *metatypes.Address) bool { func (s *Set) contain(metaBase metatypes.Address) bool {
for _, tx := range s.txArr { for _, tx := range s.txArr {
if tx.From == metaBase { if tx.From.Equal(metaBase) {
return true return true
} }
} }
......
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