Skip to content

Commit

Permalink
fix neoSrv12
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao committed Sep 13, 2018
1 parent 889cf9f commit 487d6e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 5 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"errors"
"fmt"
"log"
"nep5-balance-compare/nelapi"
"nep5-balance-compare/neoapi"
Expand All @@ -14,10 +13,6 @@ import (
"github.com/urfave/cli"
)

/*
* 当前mainnet高度2569706, testnet高度1657028
* 测试1000个地址
*/
const (
BlocksPerGroup = 20
DefaultCaseCount = 1000
Expand Down Expand Up @@ -63,8 +58,8 @@ func getAddressAndAssetID() {
}
resp, err := nelapi.GetNep5TransferByBlockIndex(params)
if err != nil {
fmt.Println(err.Error())
continue
log.Println(err.Error())
return
}
handleNep5TransferResp(resp)
i += 10
Expand All @@ -84,7 +79,7 @@ func main() {
Name: "base, b",
Usage: "The base server, usually 2.7.6",
Value: "http://47.254.44.88:10332",
Destination: &neoSrv2,
Destination: &neoSrv1,
},
cli.StringFlag{
Name: "compare, c",
Expand Down Expand Up @@ -125,7 +120,7 @@ func main() {
go func() {
resp, err := neoapi.GetAddressNep5Balance(neoSrv1, addr, asset)
if err != nil {
fmt.Println(err)
log.Println(err)
close(ch1)
return
}
Expand All @@ -134,7 +129,7 @@ func main() {
go func() {
resp, err := neoapi.GetAddressNep5Balance(neoSrv2, addr, asset)
if err != nil {
fmt.Println(err)
log.Println(err)
close(ch2)
return
}
Expand Down
4 changes: 1 addition & 3 deletions neoapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import (

//GetAddressNep5Balance get the balance of the asset
func GetAddressNep5Balance(server string, address string, assetID string) (Nep5BalanceResp, error) {
log.Println(address, assetID, server)
hash, err := utils.ToHash160(address)
if err != nil {
fmt.Println(err.Error())
log.Println(err.Error())
return Nep5BalanceResp{}, err
}
reader := strings.NewReader(`{
Expand All @@ -32,7 +31,6 @@ func GetAddressNep5Balance(server string, address string, assetID string) (Nep5B
],
"id": 3
}`)

respBytes, err := http.Request("POST", server, reader)
if err != nil {
fmt.Print(err.Error())
Expand Down

0 comments on commit 487d6e1

Please sign in to comment.