Commit ed57a11b authored by 李伟@五瓣科技's avatar 李伟@五瓣科技

count batch hash

parent f6fa7e28
......@@ -484,17 +484,13 @@ func (web *WebServicer) ProduceTxs(fromAddr string, toAddrs []string, txCount in
total := txCount
if fromAddr != systemFromAddr && first {
if fromAddr != systemFromAddr {
total = total + 1
}
for ; ; consTxNum++ {
total = total - batchTxHashSize*batchTxSize
if total <= 0 {
break
}
consTxNum = total / (batchTxHashSize * batchTxSize)
if total%(batchTxHashSize*batchTxSize) != 0 {
consTxNum = consTxNum + 1
}
SetSendRecord(id, SendRecord{TotalConsTx: int64(consTxNum)})
......
......@@ -49,6 +49,8 @@ func Start(redisAddr, passwd string) {
logTicker := time.NewTicker(5 * time.Second)
count := 0
for {
limiter.Wait(cxt)
select {
......@@ -81,17 +83,21 @@ func Start(redisAddr, passwd string) {
panic(err)
}
fmt.Printf("batchTxs.Hash: %x count: %d \n", batchTxs.Hash, count)
if err := client.LPush(context.Background(), "list", batchTxsAsBytes).Err(); err != nil {
panic(err)
}
count++
hashstr := []string{}
for _, v := range hashs {
hashstr = append(hashstr, v.Hex())
}
fmt.Printf("batchTxHash %s listLen: %d list: %v \n", fmt.Sprintf("%x", batchTxs.Hash), len(hashstr), hashstr)
//fmt.Printf("batchTxHash %s listLen: %d list: %v \n", fmt.Sprintf("%x", batchTxs.Hash), len(hashstr), hashstr)
if err := client.LPush(context.Background(), fmt.Sprintf("%x", batchTxs.Hash), hashstr); err != 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