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
a0f8a384
Commit
a0f8a384
authored
Mar 10, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sign tx arr mux
parent
cce4e4ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
signedTx.go
transaction/signedTx.go
+18
-4
No files found.
transaction/signedTx.go
View file @
a0f8a384
...
...
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"math/big"
"sync"
"sync/atomic"
"time"
)
...
...
@@ -28,9 +29,16 @@ type Transactor struct {
receivedAddr
common
.
Address
}
type
SignTranArr
struct
{
TranArr
[]
*
types
.
Transaction
mux
sync
.
Mutex
}
var
(
tran
=
make
(
chan
*
Transactor
,
0
)
tranArr
=
make
([]
*
types
.
Transaction
,
0
)
tran
=
make
(
chan
*
Transactor
,
0
)
signTranArr
=
&
SignTranArr
{
TranArr
:
make
([]
*
types
.
Transaction
,
0
),
}
batchSignCount
int32
)
...
...
@@ -84,7 +92,7 @@ func SignedTxArr(sendTxAccountArr [][]string, cfg *tool.Config) []*types.Transac
}
for
{
if
len
(
sendTxAccountArr
)
*
cfg
.
SignCount
==
int
(
batchSignCount
)
{
return
t
ranArr
return
signTranArr
.
T
ranArr
}
}
}
...
...
@@ -110,8 +118,14 @@ func signedTxFunc() (*types.Transaction, error) {
return
nil
,
err
}
txcache
.
Add
(
signedTx
.
Hash
()
.
Hex
(),
t
.
sender
.
Hex
())
tranArr
=
append
(
tranArr
,
signedTx
)
atomic
.
AddInt32
(
&
batchSignCount
,
1
)
Add
(
signedTx
)
}
}
}
func
Add
(
signedTx
*
types
.
Transaction
)
{
signTranArr
.
mux
.
Lock
()
defer
signTranArr
.
mux
.
Unlock
()
signTranArr
.
TranArr
=
append
(
signTranArr
.
TranArr
,
signedTx
)
}
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