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
246d11b1
Commit
246d11b1
authored
Mar 10, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change continued send tx
parent
686ef581
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
13 deletions
+42
-13
startTest.go
startTest.go
+42
-13
No files found.
startTest.go
View file @
246d11b1
...
@@ -4,10 +4,13 @@ import (
...
@@ -4,10 +4,13 @@ import (
"ChainGrpcTest/log"
"ChainGrpcTest/log"
"ChainGrpcTest/tool"
"ChainGrpcTest/tool"
"ChainGrpcTest/transaction"
"ChainGrpcTest/transaction"
"github.com/ethereum/go-ethereum/core/types"
"sync"
)
)
var
(
var
(
SendTxAccountArr
[][]
string
SendTxAccountArr
[][]
string
tranArrChan
chan
[]
*
types
.
Transaction
)
)
func
init
()
{
func
init
()
{
...
@@ -18,9 +21,11 @@ func init() {
...
@@ -18,9 +21,11 @@ func init() {
return
return
}
}
cfg
.
StorageAccFileName
+=
".xlsx"
cfg
.
StorageAccFileName
+=
".xlsx"
tranArrChan
=
make
(
chan
[]
*
types
.
Transaction
,
1000000000
)
}
}
func
startTest
()
{
func
startTest
()
{
if
broadcastTxArr
{
SendTxAccountArr
=
tool
.
ReadExcelOfStartEnd
(
startCount
,
endCount
,
cfg
.
StorageAccFileName
)
SendTxAccountArr
=
tool
.
ReadExcelOfStartEnd
(
startCount
,
endCount
,
cfg
.
StorageAccFileName
)
log
.
Infof
(
"Program start initAccCount:%d tranCount"
,
cfg
.
Count
)
log
.
Infof
(
"Program start initAccCount:%d tranCount"
,
cfg
.
Count
)
cfg
.
GoRoutineCount
=
goRoutineCount
cfg
.
GoRoutineCount
=
goRoutineCount
...
@@ -31,12 +36,36 @@ func startTest() {
...
@@ -31,12 +36,36 @@ func startTest() {
log
.
Errorf
(
"Bath Send Tran error: %s"
,
err
)
log
.
Errorf
(
"Bath Send Tran error: %s"
,
err
)
return
return
}
}
arr
:=
transaction
.
SignedTxArr
(
syncMap
,
SendTxAccountArr
,
cfg
)
go
func
()
{
if
broadcastTxArr
{
for
{
select
{
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
return
}
}
}
}
}
}()
for
{
arr
:=
transaction
.
SignedTxArr
(
syncMap
,
SendTxAccountArr
,
cfg
)
tranArrChan
<-
arr
updateNonce
(
syncMap
,
cfg
)
}
}
}
func
updateNonce
(
nonceMap
sync
.
Map
,
cfg
*
tool
.
Config
)
{
nonceMap
.
Range
(
func
(
key
,
value
any
)
bool
{
load
,
ok
:=
nonceMap
.
Load
(
key
)
if
!
ok
{
return
false
}
nonceMap
.
Store
(
key
,
load
.
(
int
)
+
cfg
.
SignCount
)
load
,
ok
=
nonceMap
.
Load
(
key
)
if
!
ok
{
return
false
}
log
.
Info
(
"updated addr nonce:"
,
load
)
return
true
})
}
}
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