Commit 6ad151bb authored by duanjinfei's avatar duanjinfei

callback code

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