Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChainGrpcPro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanjinfei
ChainGrpcPro
Commits
1c343e93
Commit
1c343e93
authored
Mar 10, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change continued send tx
parent
b8e06008
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
startTest.go
startTest.go
+2
-2
signedTx.go
transaction/signedTx.go
+5
-3
No files found.
startTest.go
View file @
1c343e93
...
@@ -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
...
...
transaction/signedTx.go
View file @
1c343e93
...
@@ -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
*
1
0
)
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
)
.
Set
Uint64
(
value
.
(
uint64
))
nonce
:=
new
(
big
.
Int
)
.
Set
Int64
(
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment