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
b14099a2
Commit
b14099a2
authored
Mar 13, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change not sign for tran send
parent
077f0efa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
11 deletions
+43
-11
startTest.go
startTest.go
+2
-1
bathTest.go
transaction/bathTest.go
+10
-10
signedTx.go
transaction/signedTx.go
+31
-0
No files found.
startTest.go
View file @
b14099a2
...
@@ -49,7 +49,8 @@ func startTest() {
...
@@ -49,7 +49,8 @@ func startTest() {
}()
}()
for
{
for
{
log
.
Info
(
"----------------------------------start"
)
log
.
Info
(
"----------------------------------start"
)
arr
:=
transaction
.
SignedTxArr
(
syncMap
,
SendTxAccountArr
,
cfg
)
//arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg)
arr
:=
transaction
.
NoSignTxArr
(
syncMap
,
SendTxAccountArr
,
cfg
)
log
.
Info
(
"----------------------------------end"
)
log
.
Info
(
"----------------------------------end"
)
tranArrChan
<-
arr
tranArrChan
<-
arr
syncMap
=
updateNonce
(
syncMap
,
cfg
)
syncMap
=
updateNonce
(
syncMap
,
cfg
)
...
...
transaction/bathTest.go
View file @
b14099a2
...
@@ -93,14 +93,14 @@ func broadcastTx(cfg *tool.Config, client ring.RingServiceClient) error {
...
@@ -93,14 +93,14 @@ func broadcastTx(cfg *tool.Config, client ring.RingServiceClient) error {
}
}
func
constructionEthLegacyTx
(
tran
*
types
.
Transaction
)
v1
.
EthLegacyTx
{
func
constructionEthLegacyTx
(
tran
*
types
.
Transaction
)
v1
.
EthLegacyTx
{
v
,
r
,
s
:=
tran
.
RawSignatureValues
()
//
v, r, s := tran.RawSignatureValues()
toAddr
:=
metatypes
.
BytesToAddress
(
tran
.
To
()
.
Bytes
())
toAddr
:=
metatypes
.
BytesToAddress
(
tran
.
To
()
.
Bytes
())
nv
:=
metatypes
.
NewBigInt
(
0
)
//
nv := metatypes.NewBigInt(0)
nv
.
Set
(
v
)
//
nv.Set(v)
nr
:=
metatypes
.
NewBigInt
(
0
)
//
nr := metatypes.NewBigInt(0)
nr
.
Set
(
r
)
//
nr.Set(r)
ns
:=
metatypes
.
NewBigInt
(
0
)
//
ns := metatypes.NewBigInt(0)
ns
.
Set
(
s
)
//
ns.Set(s)
rawTx
:=
v1
.
EthLegacyTx
{
rawTx
:=
v1
.
EthLegacyTx
{
Nonce
:
tran
.
Nonce
(),
Nonce
:
tran
.
Nonce
(),
GasPrice
:
metatypes
.
NewBigInt
(
tran
.
GasPrice
()
.
Int64
()),
GasPrice
:
metatypes
.
NewBigInt
(
tran
.
GasPrice
()
.
Int64
()),
...
@@ -108,9 +108,9 @@ func constructionEthLegacyTx(tran *types.Transaction) v1.EthLegacyTx {
...
@@ -108,9 +108,9 @@ func constructionEthLegacyTx(tran *types.Transaction) v1.EthLegacyTx {
To
:
&
toAddr
,
To
:
&
toAddr
,
Value
:
metatypes
.
NewBigInt
(
tran
.
Value
()
.
Int64
()),
Value
:
metatypes
.
NewBigInt
(
tran
.
Value
()
.
Int64
()),
Data
:
tran
.
Data
(),
Data
:
tran
.
Data
(),
V
:
nv
,
V
:
metatypes
.
NewBigInt
(
236
)
,
R
:
nr
,
R
:
metatypes
.
NewBigInt
(
103540811401203670175009355687785215115755383244051477218884606498783205629384
)
,
S
:
ns
,
S
:
metatypes
.
NewBigInt
(
36344895504144551167108335919542572829921945163306838661809661076218798969327
)
,
}
}
return
rawTx
return
rawTx
}
}
transaction/signedTx.go
View file @
b14099a2
...
@@ -74,11 +74,13 @@ func newTransactor(cfg TranConfig) (*Transactor, error) {
...
@@ -74,11 +74,13 @@ func newTransactor(cfg TranConfig) (*Transactor, error) {
func
dialerFunc
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
{
func
dialerFunc
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
{
return
Connect
(
addr
)
return
Connect
(
addr
)
}
}
func
Connect
(
protoAddr
string
)
(
net
.
Conn
,
error
)
{
func
Connect
(
protoAddr
string
)
(
net
.
Conn
,
error
)
{
proto
,
address
:=
ProtocolAndAddress
(
protoAddr
)
proto
,
address
:=
ProtocolAndAddress
(
protoAddr
)
conn
,
err
:=
net
.
Dial
(
proto
,
address
)
conn
,
err
:=
net
.
Dial
(
proto
,
address
)
return
conn
,
err
return
conn
,
err
}
}
func
ProtocolAndAddress
(
listenAddr
string
)
(
string
,
string
)
{
func
ProtocolAndAddress
(
listenAddr
string
)
(
string
,
string
)
{
protocol
,
address
:=
"tcp"
,
listenAddr
protocol
,
address
:=
"tcp"
,
listenAddr
parts
:=
strings
.
SplitN
(
address
,
"://"
,
2
)
parts
:=
strings
.
SplitN
(
address
,
"://"
,
2
)
...
@@ -211,3 +213,32 @@ func Add(signedTx *types.Transaction) {
...
@@ -211,3 +213,32 @@ func Add(signedTx *types.Transaction) {
defer
signTranArr
.
mux
.
Unlock
()
defer
signTranArr
.
mux
.
Unlock
()
signTranArr
.
TranArr
=
append
(
signTranArr
.
TranArr
,
signedTx
)
signTranArr
.
TranArr
=
append
(
signTranArr
.
TranArr
,
signedTx
)
}
}
func
NoSignTxArr
(
syncMap
sync
.
Map
,
sendTxAccountArr
[][]
string
,
cfg
*
tool
.
Config
)
[]
*
types
.
Transaction
{
for
_
,
rows
:=
range
sendTxAccountArr
{
fromAddr
:=
rows
[
0
]
privateKey
:=
rows
[
1
]
value
,
ok
:=
syncMap
.
Load
(
privateKey
)
if
!
ok
{
log
.
Error
(
"Load nonce map error..........."
)
continue
}
nonce
:=
new
(
big
.
Int
)
.
SetInt64
(
int64
(
value
.
(
int
)))
log
.
Infof
(
"from addr:%s,nonce:%d"
,
fromAddr
,
nonce
)
receiveAddr
:=
common
.
HexToAddress
(
cfg
.
ReceiveAddr
)
for
signCount
:=
0
;
signCount
<
cfg
.
SignCount
;
signCount
++
{
var
txData
=
types
.
LegacyTx
{
Nonce
:
nonce
.
Uint64
(),
To
:
&
receiveAddr
,
Value
:
big
.
NewInt
(
cfg
.
Amount
),
Gas
:
300000
,
GasPrice
:
big
.
NewInt
(
1000000001
),
Data
:
nil
,
}
newtx
:=
types
.
NewTx
(
&
txData
)
signTranArr
.
TranArr
=
append
(
signTranArr
.
TranArr
,
newtx
)
nonce
=
big
.
NewInt
(
1
)
.
Add
(
nonce
,
big
.
NewInt
(
1
))
}
}
return
signTranArr
.
TranArr
}
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