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