Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test #155

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.19
- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.21
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
- name: Get qng v1.0.24 dependencies
run: |
git clone https://github.com/Qitmeer/qng.git
git clone -b v1.0.24 https://github.com/Qitmeer/qng.git
cd qng && make && pwd && cp ./build/bin/qng /usr/local/bin/
cd ..
go get -v -t -d ./...
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Qitmeer/qitmeer-wallet

go 1.18
go 1.19

require (
github.com/BurntSushi/toml v1.2.0
Expand Down Expand Up @@ -78,7 +78,7 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.27.8 // indirect
github.com/libp2p/go-libp2p v0.27.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
Expand Down Expand Up @@ -142,4 +142,5 @@ require (
)

replace github.com/ethereum/go-ethereum v1.11.5 => github.com/Qitmeer/go-ethereum v1.11.5-q.3

replace github.com/karalabe/usb v0.0.2 => github.com/dindinw/karalabe-usb v0.0.0-20230613095851-cd69a62c9c30
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E
github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0=
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4=
github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8=
github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE=
github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE=
Expand Down Expand Up @@ -410,8 +408,8 @@ github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/libp2p/go-libp2p v0.27.8 h1:IX5x/4yKwyPQeVS2AXHZ3J4YATM9oHBGH1gBc23jBAI=
github.com/libp2p/go-libp2p v0.27.8/go.mod h1:eCFFtd0s5i/EVKR7+5Ki8bM7qwkNW3TPTTSSW9sz8NE=
github.com/libp2p/go-libp2p v0.27.1 h1:k1u6RHsX3hqKnslDjsSgLNURxJ3O1atIZCY4gpMbbus=
github.com/libp2p/go-libp2p v0.27.1/go.mod h1:FAvvfQa/YOShUYdiSS03IR9OXzkcJXwcNA2FUCh9ImE=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
Expand Down
9 changes: 5 additions & 4 deletions rpc/client/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"crypto/x509"
"encoding/json"
"fmt"
"github.com/Qitmeer/qng/log"
"io/ioutil"
"net"
"net/http"
"time"

"github.com/Qitmeer/qng/log"

"github.com/samuel/go-socks/socks"
)

Expand Down Expand Up @@ -90,15 +91,15 @@ func (e RPCError) Error() string {
return fmt.Sprintf("%d: %s", e.Code, e.Message)
}

//Request json req
// Request json req
type Request struct {
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params []json.RawMessage `json:"params"`
ID interface{} `json:"id"`
}

//makeRequestData
// makeRequestData
func MakeRequestData(rpcVersion string, id interface{}, method string, params []interface{}) ([]byte, error) {
// default to JSON-RPC 1.0 if RPC type is not specified
if rpcVersion != "2.0" && rpcVersion != "1.0" {
Expand Down Expand Up @@ -135,7 +136,7 @@ func MakeRequestData(rpcVersion string, id interface{}, method string, params []
return reqData, nil
}

//IsValidIDType id string number
// IsValidIDType id string number
func IsValidIDType(id interface{}) bool {
switch id.(type) {
case int, int8, int16, int32, int64,
Expand Down
3 changes: 2 additions & 1 deletion testutils/rpcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/Qitmeer/qng/rpc/client/cmds"
"io"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"sync"
"sync/atomic"

"github.com/Qitmeer/qng/rpc/client/cmds"
)

// Dial connects to a JSON-RPC server at the specified url,
Expand Down
14 changes: 6 additions & 8 deletions testutils/rpcclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
package testutils

import (
"github.com/Qitmeer/qng/config"
"github.com/Qitmeer/qng/core/event"
"github.com/Qitmeer/qng/rpc"
"github.com/Qitmeer/qng/services/mempool"
"github.com/Qitmeer/qng/testutils"
"io/ioutil"
"path/filepath"
"reflect"
"testing"
"time"

"github.com/Qitmeer/qng/config"
"github.com/Qitmeer/qng/rpc"
"github.com/Qitmeer/qng/services/mempool"
"github.com/Qitmeer/qng/testutils"
)

const (
Expand All @@ -34,7 +34,6 @@ const (
defaultMiningStateSync = false
defaultMaxInboundPeersPerHost = 10 // The default max total of inbound peer for host
defaultTrickleInterval = 10 * time.Second
defaultCacheInvalidTx = false
defaultSigCacheMaxSize = 100000
)

Expand Down Expand Up @@ -74,7 +73,6 @@ var (
DAGType: defaultDAGType,
Banning: false,
MaxInbound: defaultMaxInboundPeersPerHost,
CacheInvalidTx: defaultCacheInvalidTx,
NTP: false,
RPCListeners: []string{"127.0.0.1:5555"},
RPCUser: "test",
Expand All @@ -83,7 +81,7 @@ var (
)

func newTestServer(t *testing.T) *rpc.RpcServer {
server, err := rpc.NewRPCServer(&cfg, &event.Feed{})
server, err := rpc.NewRPCServer(&cfg, nil)
if err != nil {
t.Errorf("failed to initialize rpc server: %v", err)
}
Expand Down
7 changes: 4 additions & 3 deletions testutils/wallt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package testutils
import (
"context"
"fmt"
"math/big"
"testing"
"time"

"github.com/Qitmeer/qitmeer-wallet/config"
waddrmgr "github.com/Qitmeer/qitmeer-wallet/waddrmgs"
"github.com/Qitmeer/qng/core/types"
"github.com/Qitmeer/qng/params"
"github.com/shopspring/decimal"
"math/big"
"testing"
"time"
)

var walletCfg = &config.Config{
Expand Down
13 changes: 7 additions & 6 deletions wallet/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"crypto/x509"
"encoding/json"
"fmt"
clijson "github.com/Qitmeer/qitmeer-wallet/json"
"github.com/Qitmeer/qng/common/hash"
"github.com/Qitmeer/qng/log"
"io/ioutil"
"net"
"net/http"
"strconv"
"strings"

clijson "github.com/Qitmeer/qitmeer-wallet/json"
"github.com/Qitmeer/qng/common/hash"
"github.com/Qitmeer/qng/log"

qJson "github.com/Qitmeer/qng/core/json"

"github.com/Qitmeer/qitmeer-wallet/config"
Expand Down Expand Up @@ -348,15 +349,15 @@ func (e RPCError) Error() string {
return fmt.Sprintf("%d: %s", e.Code, e.Message)
}

//Request json req
// Request json req
type Request struct {
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params []json.RawMessage `json:"params"`
ID interface{} `json:"id"`
}

//makeRequestData
// makeRequestData
func makeRequestData(rpcVersion string, id interface{}, method string, params []interface{}) ([]byte, error) {
// default to JSON-RPC 1.0 if RPC type is not specified
if rpcVersion != "2.0" && rpcVersion != "1.0" {
Expand Down Expand Up @@ -390,7 +391,7 @@ func makeRequestData(rpcVersion string, id interface{}, method string, params []
return reqData, nil
}

//IsValidIDType id string number
// IsValidIDType id string number
func IsValidIDType(id interface{}) bool {
switch id.(type) {
case int, int8, int16, int32, int64,
Expand Down
Loading
Loading