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
efb0e002
Commit
efb0e002
authored
Mar 07, 2022
by
李伟@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add txs list
parent
67c4ca2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
http.go
http.go
+28
-0
No files found.
http.go
View file @
efb0e002
...
...
@@ -11,6 +11,7 @@ import (
"sync/atomic"
"time"
"encoding/base64"
"sync"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -139,6 +140,10 @@ func (web *WebServicer) GetTreeHandler(w http.ResponseWriter, r *http.Request) {
consTxWithBatchHash
=
append
(
consTxWithBatchHash
,
v
.
ConsTxWithBatchHash
...
)
}
for
k
,
v
:=
range
consTxWithBatchHash
{
fmt
.
Printf
(
"idx: %d v: %d
\n
"
,
k
,
len
(
v
.
BatchTxsHash
))
}
recordAsJon
,
err
:=
json
.
Marshal
(
consTxWithBatchHash
)
if
err
!=
nil
{
...
...
@@ -160,6 +165,28 @@ func (web *WebServicer) GetTreeHandler(w http.ResponseWriter, r *http.Request) {
}
func
(
web
*
WebServicer
)
GetTxsList
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
vars
:=
mux
.
Vars
(
r
)
hashStr
:=
vars
[
"hash"
]
// hashAsBytes := []byte(hashStr)
hashAsBytes
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
hashStr
)
if
err
!=
nil
{
http
.
Error
(
w
,
err
.
Error
(),
http
.
StatusBadRequest
)
return
}
// if err := json.Unmarshal(hashStr, &hashAsBytes); err != nil {
// http.Error(w, err.Error(), http.StatusBadRequest)
// return
// }
fmt
.
Printf
(
"hashStr: %s len(hashStr): %d len(hashAsBytes): %d
\n
"
,
hashStr
,
len
(
hashStr
),
len
(
hashAsBytes
))
}
func
(
web
*
WebServicer
)
WebService
(
config
Config
)
error
{
r
:=
mux
.
NewRouter
()
// Routes consist of a path and a handler function.
...
...
@@ -167,6 +194,7 @@ func (web *WebServicer) WebService(config Config) error {
//r.HandleFunc("/faucet/{addr}", web.FaucetHandler)
r
.
HandleFunc
(
"/process/{uuid}"
,
web
.
ProcessHandler
)
r
.
HandleFunc
(
"/tree/{uuid}"
,
web
.
GetTreeHandler
)
r
.
HandleFunc
(
"/txslist/{hash}"
,
web
.
GetTxsList
)
r
.
HandleFunc
(
"/txs"
,
web
.
TxsHandler
)
.
Methods
(
"POST"
)
clientFactory
,
exists
:=
clientFactories
[
"ethclient"
]
...
...
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