Commit 1c343e93 authored by duanjinfei's avatar duanjinfei

change continued send tx

parent b8e06008
...@@ -42,7 +42,6 @@ func startTest() { ...@@ -42,7 +42,6 @@ func startTest() {
case arr := <-tranArrChan: case arr := <-tranArrChan:
if err := transaction.BroadcastTxArr(arr, cfg); err != nil { if err := transaction.BroadcastTxArr(arr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err) log.Errorf("Bath Send Tran error: %s", err)
return
} }
} }
} }
...@@ -61,7 +60,8 @@ func updateNonce(nonceMap sync.Map, cfg *tool.Config) sync.Map { ...@@ -61,7 +60,8 @@ func updateNonce(nonceMap sync.Map, cfg *tool.Config) sync.Map {
if !ok { if !ok {
return false return false
} }
newNonceMap.Store(key, load.(int)+cfg.SignCount) nonce := load.(int)
newNonceMap.Store(key, nonce+cfg.SignCount)
load, ok = newNonceMap.Load(key) load, ok = newNonceMap.Load(key)
if !ok { if !ok {
return false return false
......
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"math/big" "math/big"
"net" "net"
"strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
...@@ -108,13 +109,14 @@ func InitAccNonce(sendTxAccountArr [][]string, cfg *tool.Config) (error, sync.Ma ...@@ -108,13 +109,14 @@ func InitAccNonce(sendTxAccountArr [][]string, cfg *tool.Config) (error, sync.Ma
nonceReq := &ring.NonceRequest{ nonceReq := &ring.NonceRequest{
Address: (*metatypes.Address)(fromAddr.Bytes()), Address: (*metatypes.Address)(fromAddr.Bytes()),
} }
ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel() defer cancel()
response, err := serviceClient.Nonce(ctx, nonceReq) response, err := serviceClient.Nonce(ctx, nonceReq)
if err != nil { if err != nil {
log.Error("get account nonce error:", err) log.Error("get account nonce error:", err)
} }
accountsNonceMap.Store(privateKey, response.Nonce) intNum, _ := strconv.Atoi(strconv.FormatUint(response.Nonce, 10))
accountsNonceMap.Store(privateKey, intNum)
atomic.AddInt32(&handleNonceCount, 1) atomic.AddInt32(&handleNonceCount, 1)
} }
} }
...@@ -144,7 +146,7 @@ func SignedTxArr(syncMap sync.Map, sendTxAccountArr [][]string, cfg *tool.Config ...@@ -144,7 +146,7 @@ func SignedTxArr(syncMap sync.Map, sendTxAccountArr [][]string, cfg *tool.Config
log.Error("Load nonce map error...........") log.Error("Load nonce map error...........")
continue continue
} }
nonce := new(big.Int).SetUint64(value.(uint64)) nonce := new(big.Int).SetInt64(int64(value.(int)))
log.Infof("from addr:%s,nonce:%d", fromAddr, nonce) log.Infof("from addr:%s,nonce:%d", fromAddr, nonce)
for signCount := 0; signCount < cfg.SignCount; signCount++ { for signCount := 0; signCount < cfg.SignCount; signCount++ {
tranCfg := TranConfig{ tranCfg := TranConfig{
......
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