Commit 6ad151bb authored by duanjinfei's avatar duanjinfei

callback code

parent b4e5d6be
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"ChainGrpcTest/tool" "ChainGrpcTest/tool"
"ChainGrpcTest/transaction" "ChainGrpcTest/transaction"
"sync" "sync"
"time"
) )
var ( var (
...@@ -52,14 +53,15 @@ func startTest() { ...@@ -52,14 +53,15 @@ func startTest() {
} }
}() }()
//} //}
//for { for {
log.Info("----------------------------------start") log.Info("----------------------------------start")
//arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg) //arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg)
arr := transaction.NoSignTxArr(syncMap, SendTxAccountArr, cfg) arr := transaction.NoSignTxArr(syncMap, SendTxAccountArr, cfg)
log.Info("----------------------------------end") log.Info("----------------------------------end")
tranArrChan <- arr tranArrChan <- arr
syncMap = updateNonce(syncMap, cfg) syncMap = updateNonce(syncMap, cfg)
//} time.Sleep(time.Second * 120)
}
} }
} }
func updateNonce(nonceMap sync.Map, cfg *tool.Config) sync.Map { func updateNonce(nonceMap sync.Map, cfg *tool.Config) sync.Map {
......
...@@ -39,7 +39,7 @@ func InitBroadcastTxGoroutine(cfg *tool.Config) error { ...@@ -39,7 +39,7 @@ func InitBroadcastTxGoroutine(cfg *tool.Config) error {
func BroadcastTxArr(tranArr []*TxFromTran, cfg *tool.Config) error { func BroadcastTxArr(tranArr []*TxFromTran, cfg *tool.Config) error {
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
log.Info("allSignedTxCount:", allSignedTxCount) log.Info("allSignedTxCount:", allSignedTxCount)
startTime := time.Now() //startTime := time.Now()
ethTxArr := make([]*ring.BroadcastEthTxWithFromRequest, 0) ethTxArr := make([]*ring.BroadcastEthTxWithFromRequest, 0)
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
inner := constructionEthLegacyTx(tranArr[i].Tran) inner := constructionEthLegacyTx(tranArr[i].Tran)
...@@ -60,16 +60,16 @@ func BroadcastTxArr(tranArr []*TxFromTran, cfg *tool.Config) error { ...@@ -60,16 +60,16 @@ func BroadcastTxArr(tranArr []*TxFromTran, cfg *tool.Config) error {
ethTxArr = make([]*ring.BroadcastEthTxWithFromRequest, 0) ethTxArr = make([]*ring.BroadcastEthTxWithFromRequest, 0)
} }
} }
for { //for {
if bathHandleSendCount == allSignedTxCount { // if bathHandleSendCount == allSignedTxCount {
log.Info("beforeBathHandleSendCount:", beforeBathHandleSendCount) // log.Info("beforeBathHandleSendCount:", beforeBathHandleSendCount)
log.Infof("Send tran count: %d", bathHandleSendCount) // log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds()) // log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
log.Infof("Send tran total time: %d ms", totalSendTime) // log.Infof("Send tran total time: %d ms", totalSendTime)
bathHandleSendCount = 0 // bathHandleSendCount = 0
break // break
} // }
} //}
return nil return nil
} }
......
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