Commit babaa782 authored by kingwang's avatar kingwang

fix linter

parent 2e832209
...@@ -8,6 +8,7 @@ datadir* ...@@ -8,6 +8,7 @@ datadir*
.idea .idea
.vscode .vscode
build/chain33* build/chain33*
chain33_raft-1
build/datadir build/datadir
build/bityuan* build/bityuan*
build/para build/para
......
...@@ -13,7 +13,6 @@ CHAIN33_PATH=vendor/${CHAIN33} ...@@ -13,7 +13,6 @@ CHAIN33_PATH=vendor/${CHAIN33}
LDFLAGS := -ldflags "-w -s" LDFLAGS := -ldflags "-w -s"
PKG_LIST_VET := `go list ./... | grep -v "vendor" | grep -v plugin/dapp/evm/executor/vm/common/crypto/bn256` PKG_LIST_VET := `go list ./... | grep -v "vendor" | grep -v plugin/dapp/evm/executor/vm/common/crypto/bn256`
PKG_LIST := `go list ./... | grep -v "vendor" | grep -v "chain33/test" | grep -v "mocks" | grep -v "pbft"` PKG_LIST := `go list ./... | grep -v "vendor" | grep -v "chain33/test" | grep -v "mocks" | grep -v "pbft"`
PKG_LIST_Q := `go list ./... | grep -v "vendor" | grep -v "chain33/test" | grep -v "mocks" | grep -v "blockchain" | grep -v "pbft"`
BUILD_FLAGS = -ldflags "-X github.com/33cn/chain33/common/version.GitCommit=`git rev-parse --short=8 HEAD`" BUILD_FLAGS = -ldflags "-X github.com/33cn/chain33/common/version.GitCommit=`git rev-parse --short=8 HEAD`"
MKPATH=$(abspath $(lastword $(MAKEFILE_LIST))) MKPATH=$(abspath $(lastword $(MAKEFILE_LIST)))
MKDIR=$(dir $(MKPATH)) MKDIR=$(dir $(MKPATH))
...@@ -88,6 +87,9 @@ race: ## Run data race detector ...@@ -88,6 +87,9 @@ race: ## Run data race detector
test: ## Run unittests test: ## Run unittests
@go test -race $(PKG_LIST) @go test -race $(PKG_LIST)
testq: ## Run unittests
@go test $(PKG_LIST)
fmt: fmt_proto fmt_shell ## go fmt fmt: fmt_proto fmt_shell ## go fmt
@go fmt ./... @go fmt ./...
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w @find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
......
...@@ -149,7 +149,7 @@ func prepareTxList() *types.Transaction { ...@@ -149,7 +149,7 @@ func prepareTxList() *types.Transaction {
key = generateKey(i, 32) key = generateKey(i, 32)
value = generateValue(i, 180) value = generateValue(i, 180)
nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: key, Value: []byte(value)}} nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: []byte(key), Value: []byte(value)}}
action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut} action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut}
tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: 0} tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: 0}
tx.To = address.ExecAddress("norm") tx.To = address.ExecAddress("norm")
......
...@@ -330,7 +330,7 @@ func RandStringBytes(n int) string { ...@@ -330,7 +330,7 @@ func RandStringBytes(n int) string {
// NormPut run put action // NormPut run put action
func NormPut(privkey string, key string, value string) { func NormPut(privkey string, key string, value string) {
fmt.Println(key, "=", value) fmt.Println(key, "=", value)
nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: key, Value: []byte(value)}} nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: []byte(key), Value: []byte(value)}}
action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut} action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut}
tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: fee} tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: fee}
tx.To = address.ExecAddress("norm") tx.To = address.ExecAddress("norm")
...@@ -350,7 +350,7 @@ func NormPut(privkey string, key string, value string) { ...@@ -350,7 +350,7 @@ func NormPut(privkey string, key string, value string) {
// NormGet run query action // NormGet run query action
func NormGet(key string) { func NormGet(key string) {
in := &pty.NormGetKey{Key: key} in := &pty.NormGetKey{Key: []byte(key)}
data, err := proto.Marshal(in) data, err := proto.Marshal(in)
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
......
...@@ -147,7 +147,7 @@ func prepareTxList() *types.Transaction { ...@@ -147,7 +147,7 @@ func prepareTxList() *types.Transaction {
key = generateKey(i, 32) key = generateKey(i, 32)
value = generateValue(i, 180) value = generateValue(i, 180)
nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: key, Value: []byte(value)}} nput := &pty.NormAction_Nput{Nput: &pty.NormPut{Key: []byte(key), Value: []byte(value)}}
action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut} action := &pty.NormAction{Value: nput, Ty: pty.NormActionPut}
tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: fee} tx := &types.Transaction{Execer: []byte("norm"), Payload: types.Encode(action), Fee: fee}
tx.To = address.ExecAddress("norm") tx.To = address.ExecAddress("norm")
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -53,7 +53,7 @@ func (n *Norm) CheckTx(tx *types.Transaction, index int) error { ...@@ -53,7 +53,7 @@ func (n *Norm) CheckTx(tx *types.Transaction, index int) error {
} }
// Key for norm // Key for norm
func Key(str string) (key []byte) { func Key(str []byte) (key []byte) {
key = append(key, []byte("mavl-norm-")...) key = append(key, []byte("mavl-norm-")...)
key = append(key, str...) key = append(key, str...)
return key return key
......
...@@ -4,7 +4,7 @@ package types; ...@@ -4,7 +4,7 @@ package types;
message Norm { message Norm {
bytes normId = 1; bytes normId = 1;
int64 createTime = 2; int64 createTime = 2;
string key = 3; bytes key = 3;
bytes value = 4; bytes value = 4;
} }
...@@ -16,10 +16,10 @@ message NormAction { ...@@ -16,10 +16,10 @@ message NormAction {
} }
message NormPut { message NormPut {
string key = 1; bytes key = 1;
bytes value = 2; bytes value = 2;
} }
message NormGetKey { message NormGetKey {
string key = 1; bytes key = 1;
} }
\ No newline at end of file
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
...@@ -24,7 +23,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package ...@@ -24,7 +23,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Norm struct { type Norm struct {
NormId []byte `protobuf:"bytes,1,opt,name=normId,proto3" json:"normId,omitempty"` NormId []byte `protobuf:"bytes,1,opt,name=normId,proto3" json:"normId,omitempty"`
CreateTime int64 `protobuf:"varint,2,opt,name=createTime,proto3" json:"createTime,omitempty"` CreateTime int64 `protobuf:"varint,2,opt,name=createTime,proto3" json:"createTime,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -70,11 +69,11 @@ func (m *Norm) GetCreateTime() int64 { ...@@ -70,11 +69,11 @@ func (m *Norm) GetCreateTime() int64 {
return 0 return 0
} }
func (m *Norm) GetKey() string { func (m *Norm) GetKey() []byte {
if m != nil { if m != nil {
return m.Key return m.Key
} }
return "" return nil
} }
func (m *Norm) GetValue() []byte { func (m *Norm) GetValue() []byte {
...@@ -206,7 +205,7 @@ func _NormAction_OneofSizer(msg proto.Message) (n int) { ...@@ -206,7 +205,7 @@ func _NormAction_OneofSizer(msg proto.Message) (n int) {
} }
type NormPut struct { type NormPut struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
...@@ -238,11 +237,11 @@ func (m *NormPut) XXX_DiscardUnknown() { ...@@ -238,11 +237,11 @@ func (m *NormPut) XXX_DiscardUnknown() {
var xxx_messageInfo_NormPut proto.InternalMessageInfo var xxx_messageInfo_NormPut proto.InternalMessageInfo
func (m *NormPut) GetKey() string { func (m *NormPut) GetKey() []byte {
if m != nil { if m != nil {
return m.Key return m.Key
} }
return "" return nil
} }
func (m *NormPut) GetValue() []byte { func (m *NormPut) GetValue() []byte {
...@@ -253,7 +252,7 @@ func (m *NormPut) GetValue() []byte { ...@@ -253,7 +252,7 @@ func (m *NormPut) GetValue() []byte {
} }
type NormGetKey struct { type NormGetKey struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -284,11 +283,11 @@ func (m *NormGetKey) XXX_DiscardUnknown() { ...@@ -284,11 +283,11 @@ func (m *NormGetKey) XXX_DiscardUnknown() {
var xxx_messageInfo_NormGetKey proto.InternalMessageInfo var xxx_messageInfo_NormGetKey proto.InternalMessageInfo
func (m *NormGetKey) GetKey() string { func (m *NormGetKey) GetKey() []byte {
if m != nil { if m != nil {
return m.Key return m.Key
} }
return "" return nil
} }
func init() { func init() {
...@@ -301,19 +300,19 @@ func init() { ...@@ -301,19 +300,19 @@ func init() {
func init() { proto.RegisterFile("norm.proto", fileDescriptor_4c505000707f0293) } func init() { proto.RegisterFile("norm.proto", fileDescriptor_4c505000707f0293) }
var fileDescriptor_4c505000707f0293 = []byte{ var fileDescriptor_4c505000707f0293 = []byte{
// 211 bytes of a gzipped FileDescriptorProto // 209 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc6, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xca, 0xcb, 0x2f, 0xca,
0x10, 0x84, 0x4d, 0xda, 0xfc, 0xc5, 0x55, 0x8a, 0x04, 0x91, 0x9c, 0x4a, 0x28, 0x1e, 0x72, 0x2a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x56, 0x4a, 0xe3,
0xa8, 0x4f, 0xa0, 0x17, 0x95, 0x82, 0x48, 0xf0, 0x05, 0x6a, 0x5d, 0xa1, 0x68, 0x9b, 0x12, 0xb7, 0x62, 0xf1, 0xcb, 0x2f, 0xca, 0x15, 0x12, 0xe3, 0x62, 0x03, 0x49, 0x7a, 0xa6, 0x48, 0x30, 0x2a,
0x42, 0xde, 0x5e, 0x92, 0x56, 0x28, 0xe8, 0x2d, 0x93, 0x99, 0x9d, 0x6f, 0x59, 0x80, 0xc9, 0xf9, 0x30, 0x6a, 0xf0, 0x04, 0x41, 0x79, 0x42, 0x72, 0x5c, 0x5c, 0xc9, 0x45, 0xa9, 0x89, 0x25, 0xa9,
0xb1, 0x99, 0xbd, 0x23, 0x27, 0x05, 0x85, 0x19, 0xbf, 0xea, 0x77, 0xc8, 0x9f, 0x9c, 0x1f, 0xe5, 0x21, 0x99, 0xb9, 0xa9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x48, 0x22, 0x42, 0x02, 0x5c,
0x05, 0x1c, 0xa2, 0xf9, 0xf8, 0xa6, 0x98, 0x66, 0xe6, 0xd4, 0x6e, 0x4a, 0x56, 0x00, 0xbd, 0xc7, 0xcc, 0xd9, 0xa9, 0x95, 0x12, 0xcc, 0x60, 0x4d, 0x20, 0xa6, 0x90, 0x08, 0x17, 0x6b, 0x59, 0x62,
0x8e, 0xf0, 0x65, 0x18, 0x51, 0x71, 0xcd, 0x4c, 0x66, 0x77, 0x3f, 0xf2, 0x0c, 0xb2, 0x0f, 0x0c, 0x4e, 0x69, 0xaa, 0x04, 0x0b, 0x58, 0x0c, 0xc2, 0x51, 0xf2, 0xe6, 0xe2, 0x02, 0xd9, 0xe3, 0x98,
0x2a, 0xd3, 0xcc, 0x1c, 0xdb, 0xf8, 0x94, 0xe7, 0x20, 0xbe, 0xbb, 0xcf, 0x05, 0x55, 0x9e, 0x8a, 0x5c, 0x92, 0x99, 0x9f, 0x27, 0xa4, 0xc2, 0xc5, 0x92, 0x57, 0x50, 0x5a, 0x02, 0xb6, 0x8b, 0xdb,
0x56, 0x51, 0xb7, 0x00, 0x91, 0x73, 0xdb, 0xd3, 0xe0, 0x26, 0x79, 0x09, 0xf9, 0x34, 0x2f, 0x94, 0x88, 0x4f, 0x0f, 0xec, 0x16, 0x3d, 0x90, 0x82, 0x80, 0xd2, 0x12, 0x0f, 0x86, 0x20, 0xb0, 0xac,
0x58, 0x27, 0xd7, 0x65, 0x93, 0x76, 0x69, 0x62, 0xe0, 0x79, 0xa1, 0x87, 0x23, 0x9b, 0x5c, 0x59, 0x10, 0x1f, 0x17, 0x53, 0x49, 0xa5, 0x04, 0xab, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x53, 0x49, 0xa5,
0x02, 0xa7, 0xa0, 0x84, 0x66, 0x46, 0x58, 0x4e, 0xe1, 0xae, 0xd8, 0x9a, 0xeb, 0x2b, 0x28, 0xb6, 0x13, 0x3b, 0xd4, 0x64, 0x25, 0x43, 0x2e, 0x76, 0xa8, 0x5a, 0x98, 0xfd, 0x8c, 0x58, 0xec, 0x67,
0xec, 0x2f, 0x9f, 0xfd, 0xc3, 0xe7, 0x7b, 0x7e, 0xb5, 0xf2, 0xef, 0x91, 0x5a, 0x0c, 0x7f, 0xa7, 0x42, 0xb6, 0x5f, 0x0e, 0x62, 0xbf, 0x7b, 0x6a, 0x89, 0x77, 0x6a, 0x25, 0xa6, 0xae, 0x24, 0x36,
0x5e, 0x0f, 0xe9, 0x2a, 0x37, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x77, 0x91, 0xf3, 0x23, 0x70, 0xa8, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x32, 0x24, 0xd0, 0x7e, 0x23, 0x01, 0x00,
0x01, 0x00, 0x00, 0x00,
} }
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -234,7 +234,7 @@ func testStore_listFrozenUTXOs(t *testing.T) { ...@@ -234,7 +234,7 @@ func testStore_listFrozenUTXOs(t *testing.T) {
txs, err = store.listFrozenUTXOs(token, addr) txs, err = store.listFrozenUTXOs(token, addr)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, 1, len(txs)) assert.Equal(t, 1, len(txs))
assert.Equal(t, tx, txs[0]) assert.Equal(t, true, proto.Equal(tx, txs[0]))
} }
func testStore_listAvailableUTXOs(t *testing.T) { func testStore_listAvailableUTXOs(t *testing.T) {
...@@ -260,7 +260,7 @@ func testStore_listAvailableUTXOs(t *testing.T) { ...@@ -260,7 +260,7 @@ func testStore_listAvailableUTXOs(t *testing.T) {
utxos, err = store.listAvailableUTXOs(token, addr) utxos, err = store.listAvailableUTXOs(token, addr)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, 1, len(utxos)) assert.Equal(t, 1, len(utxos))
assert.Equal(t, utxo, utxos[0]) assert.Equal(t, true, proto.Equal(utxo, utxos[0]))
} }
func testStore_setWalletAccountPrivacy(t *testing.T) { func testStore_setWalletAccountPrivacy(t *testing.T) {
...@@ -291,7 +291,7 @@ func testStore_getAccountByAddr(t *testing.T) { ...@@ -291,7 +291,7 @@ func testStore_getAccountByAddr(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
err = store.Set(calcAddrKey(addr), bt) err = store.Set(calcAddrKey(addr), bt)
was, err = store.getAccountByAddr(addr) was, err = store.getAccountByAddr(addr)
assert.Equal(t, was, account) assert.Equal(t, true, proto.Equal(was, account))
assert.NoError(t, err) assert.NoError(t, err)
} }
...@@ -325,7 +325,7 @@ func testStore_getAccountByPrefix(t *testing.T) { ...@@ -325,7 +325,7 @@ func testStore_getAccountByPrefix(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
was, err = store.getAccountByAddr(addr) was, err = store.getAccountByAddr(addr)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, was, account) assert.Equal(t, true, proto.Equal(was, account))
} }
func testStore_setVersion(t *testing.T) { func testStore_setVersion(t *testing.T) {
......
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"github.com/33cn/chain33/common/db/mocks" "github.com/33cn/chain33/common/db/mocks"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
ty "github.com/33cn/plugin/plugin/dapp/relay/types" ty "github.com/33cn/plugin/plugin/dapp/relay/types"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
...@@ -1197,8 +1198,10 @@ func (s *suiteSaveBtcHeader) TestSaveBtcHeader_1() { ...@@ -1197,8 +1198,10 @@ func (s *suiteSaveBtcHeader) TestSaveBtcHeader_1() {
s.Zero(log.LastBaseHeight) s.Zero(log.LastBaseHeight)
s.Equal(head2.Height, log.NewHeight) s.Equal(head2.Height, log.NewHeight)
s.Zero(log.NewBaseHeight) s.Zero(log.NewBaseHeight)
s.Equal(headers.BtcHeader, log.Headers) s.Equal(len(headers.BtcHeader), len(log.Headers))
for i, h := range headers.BtcHeader {
s.Equal(true, proto.Equal(h, log.Headers[i]))
}
} }
//not continuous //not continuous
...@@ -1325,8 +1328,10 @@ func (s *suiteSaveBtcHeader) TestSaveBtcHeader_4() { ...@@ -1325,8 +1328,10 @@ func (s *suiteSaveBtcHeader) TestSaveBtcHeader_4() {
s.Zero(log.LastBaseHeight) s.Zero(log.LastBaseHeight)
s.Equal(head5.Height, log.NewHeight) s.Equal(head5.Height, log.NewHeight)
s.Equal(head4.Height, log.NewBaseHeight) s.Equal(head4.Height, log.NewBaseHeight)
s.Equal(headers.BtcHeader, log.Headers) s.Equal(len(headers.BtcHeader), len(log.Headers))
for i, h := range headers.BtcHeader {
s.Equal(true, proto.Equal(h, log.Headers[i]))
}
} }
func TestRunSuiteSaveBtcHeader(t *testing.T) { func TestRunSuiteSaveBtcHeader(t *testing.T) {
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -148,7 +148,7 @@ func TestRPC_CallTestNode(t *testing.T) { ...@@ -148,7 +148,7 @@ func TestRPC_CallTestNode(t *testing.T) {
var result = "" var result = ""
err = jsonClient.Call("Chain33.Version", nil, &result) err = jsonClient.Call("Chain33.Version", nil, &result)
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, "5.3.0", result) assert.Equal(t, "6.0.1", result)
var isSnyc bool var isSnyc bool
err = jsonClient.Call("Chain33.IsSync", &types.ReqNil{}, &isSnyc) err = jsonClient.Call("Chain33.IsSync", &types.ReqNil{}, &isSnyc)
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -121,10 +121,8 @@ func TestProtoNewEncodeOldDecode(t *testing.T) { ...@@ -121,10 +121,8 @@ func TestProtoNewEncodeOldDecode(t *testing.T) {
told := &TicketMinerOld{} told := &TicketMinerOld{}
err := types.Decode(data, told) err := types.Decode(data, told)
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, &TicketMinerOld{ assert.Equal(t, told.Bits, uint32(1))
Bits: 1, assert.Equal(t, told.Reward, int64(1))
Reward: 1, assert.Equal(t, told.TicketId, "id")
TicketId: "id", assert.Equal(t, told.Modify, []byte("modify"))
Modify: []byte("modify"),
}, told)
} }
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -6,11 +6,10 @@ package types ...@@ -6,11 +6,10 @@ package types
import ( import (
context "context" context "context"
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,10 +5,9 @@ package types ...@@ -5,10 +5,9 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
types "github.com/33cn/chain33/types" types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment