Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multisend
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
李伟@五瓣科技
multisend
Commits
b242a850
Commit
b242a850
authored
Mar 09, 2022
by
李伟@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MaxRequestAmount
parent
9f69e02a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
http.go
http.go
+19
-18
No files found.
http.go
View file @
b242a850
...
...
@@ -395,8 +395,8 @@ func FloatRound(f float64, n int) float64 {
}
type
TxParams
struct
{
From
string
`json:"from,omitempty"`
//
RequestAmount int64 `json:"request_amount"`
From
string
`json:"from,omitempty"`
RequestAmount
int64
`json:"request_amount"`
ToAddrs
[]
string
`json:"to_addrs"`
BatchTxSize
int64
`json:"batch_tx_size,omitempty"`
BatchTxHashSize
int64
`json:"batch_tx_hash_size,omitempty"`
...
...
@@ -427,15 +427,30 @@ func (web *WebServicer) TxsHandler(w http.ResponseWriter, r *http.Request) {
atomic
.
StoreInt32
(
&
Running
,
1
)
if
params
.
EveryTxAmount
*
params
.
TxCount
>
MaxRequestAm
ount
{
if
params
.
RequestAmount
>
MaxRequestAmount
||
params
.
RequestAmount
<
params
.
EveryTxAmount
*
params
.
TxC
ount
{
http
.
Error
(
w
,
fmt
.
Sprintf
(
"params.
EveryTxAmount*params.TxCount > MaxRequestAmount > %d"
,
MaxRequestAm
ount
),
http
.
StatusBadRequest
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"params.
RequestAmount %d > MaxRequestAmount %d|| params.RequestAmount %d < params.EveryTxAmount*params.TxCount %d *%d "
,
params
.
RequestAmount
,
MaxRequestAmount
,
params
.
RequestAmount
,
params
.
EveryTxAmount
,
params
.
TxC
ount
),
http
.
StatusBadRequest
)
return
}
id
:=
uuid
.
New
()
consTxNum
:=
0
total
:=
int
(
params
.
TxCount
)
if
params
.
From
!=
systemFromAddr
{
total
=
total
+
1
}
consTxNum
=
total
/
(
batchTxHashSize
*
batchTxSize
)
if
total
%
(
batchTxHashSize
*
batchTxSize
)
!=
0
{
consTxNum
=
consTxNum
+
1
}
SetSendRecord
(
id
,
SendRecord
{
TotalConsTx
:
int64
(
consTxNum
)})
go
func
()
{
if
err
:=
web
.
ProduceTxs
(
params
.
From
,
params
.
ToAddrs
,
int
(
params
.
TxCount
),
params
.
EveryTxAmount
,
id
);
err
!=
nil
{
http
.
Error
(
w
,
err
.
Error
(),
http
.
StatusInternalServerError
)
...
...
@@ -478,24 +493,10 @@ type WebResp struct {
}
func
(
web
*
WebServicer
)
ProduceTxs
(
fromAddr
string
,
toAddrs
[]
string
,
txCount
int
,
amount
int64
,
id
uuid
.
UUID
)
error
{
consTxNum
:=
0
addrsL
:=
len
(
toAddrs
)
first
:=
true
total
:=
txCount
if
fromAddr
!=
systemFromAddr
{
total
=
total
+
1
}
consTxNum
=
total
/
(
batchTxHashSize
*
batchTxSize
)
if
total
%
(
batchTxHashSize
*
batchTxSize
)
!=
0
{
consTxNum
=
consTxNum
+
1
}
SetSendRecord
(
id
,
SendRecord
{
TotalConsTx
:
int64
(
consTxNum
)})
for
{
var
hashesBytes
[]
byte
=
make
([]
byte
,
0
,
32
*
batchTxHashSize
)
...
...
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