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

Cleanup #1750

Merged
merged 2 commits into from
Dec 20, 2019
Merged

Cleanup #1750

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
2 changes: 1 addition & 1 deletion account/address.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package account

import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
)

Expand Down
2 changes: 1 addition & 1 deletion account/generator/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/ecdsa"
"crypto/sha256"

"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/extkeys"
)
Expand Down
2 changes: 1 addition & 1 deletion account/generator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"

"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/extkeys"
)

Expand Down
2 changes: 1 addition & 1 deletion account/onboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package account
import (
"fmt"

"github.com/ethereum/go-ethereum/crypto"
"github.com/pborman/uuid"
"github.com/status-im/status-go/account/generator"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/extkeys"
)
Expand Down
2 changes: 1 addition & 1 deletion api/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"strings"

"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/eth-node/crypto"
)

// RunAsync runs the specified function asynchronously.
Expand Down
8 changes: 4 additions & 4 deletions eth-node/bridge/nimbus/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ import (
type nimbusNodeWrapper struct {
mu sync.Mutex

routineQueue *RoutineQueue
tid int
routineQueue *RoutineQueue
tid int
nodeStarted bool
cancelPollingChan chan struct{}

w types.Whisper
w types.Whisper
}

type Node interface {
Expand Down Expand Up @@ -122,7 +122,7 @@ func (n *nimbusNodeWrapper) poll() {
panic("poll called from wrong thread")
}

if (n.nodeStarted) {
if n.nodeStarted {
C.nimbus_poll()
}

Expand Down
2 changes: 1 addition & 1 deletion lib/library_test_multiaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"C"
"encoding/json"

"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/eth-node/crypto"
mobile "github.com/status-im/status-go/mobile"
)
import (
Expand Down
10 changes: 5 additions & 5 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"strings"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/params"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/static"
"github.com/status-im/status-go/whisper/v6"
validator "gopkg.in/go-playground/validator.v9"
Expand Down Expand Up @@ -890,11 +890,11 @@ func (c *NodeConfig) AddAPIModule(m string) {
func LesTopic(netid int) string {
switch netid {
case 1:
return LESDiscoveryIdentifier + common.Bytes2Hex(params.MainnetGenesisHash.Bytes()[:8])
return LESDiscoveryIdentifier + types.Bytes2Hex(params.MainnetGenesisHash.Bytes()[:8])
case 3:
return LESDiscoveryIdentifier + common.Bytes2Hex(params.TestnetGenesisHash.Bytes()[:8])
return LESDiscoveryIdentifier + types.Bytes2Hex(params.TestnetGenesisHash.Bytes()[:8])
case 4:
return LESDiscoveryIdentifier + common.Bytes2Hex(params.RinkebyGenesisHash.Bytes()[:8])
return LESDiscoveryIdentifier + types.Bytes2Hex(params.RinkebyGenesisHash.Bytes()[:8])
default:
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/message_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (s *MessageProcessorSuite) TestHandleDecodedMessagesDatasyncEncrypted() {

dataSyncMessage := datasyncproto.Payload{
Messages: []*datasyncproto.Message{
&datasyncproto.Message{Body: wrappedPayload},
{Body: wrappedPayload},
},
}
marshalledDataSyncMessage, err := proto.Marshal(&dataSyncMessage)
Expand Down
4 changes: 2 additions & 2 deletions protocol/messenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -1468,11 +1468,11 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
}
}

for id, _ := range modifiedChats {
for id := range modifiedChats {
response.Chats = append(response.Chats, m.allChats[id])
}

for id, _ := range modifiedContacts {
for id := range modifiedContacts {
response.Contacts = append(response.Contacts, m.allContacts[id])
}

Expand Down
38 changes: 19 additions & 19 deletions protocol/messenger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,17 +1097,17 @@ func (s *MessengerSuite) TestChatPersistencePrivateGroupChat() {
ChatType: ChatTypePrivateGroupChat,
Timestamp: 10,
Members: []ChatMember{
ChatMember{
{
ID: "1",
Admin: false,
Joined: true,
},
ChatMember{
{
ID: "2",
Admin: true,
Joined: false,
},
ChatMember{
{
ID: "3",
Admin: true,
Joined: true,
Expand Down Expand Up @@ -1157,12 +1157,12 @@ func (s *MessengerSuite) TestBlockContact() {
LastUpdated: 20,
SystemTags: []string{"1", "2"},
DeviceInfo: []ContactDeviceInfo{
ContactDeviceInfo{
{
InstallationID: "1",
Timestamp: 2,
FCMToken: "token",
},
ContactDeviceInfo{
{
InstallationID: "2",
Timestamp: 3,
FCMToken: "token-2",
Expand Down Expand Up @@ -1216,7 +1216,7 @@ func (s *MessengerSuite) TestBlockContact() {
contact.Name = "blocked"

messages := []*Message{
&Message{
{
ID: "test-1",
LocalChatID: chat2.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1226,7 +1226,7 @@ func (s *MessengerSuite) TestBlockContact() {
},
From: contact.ID,
},
&Message{
{
ID: "test-2",
LocalChatID: chat2.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1236,7 +1236,7 @@ func (s *MessengerSuite) TestBlockContact() {
},
From: contact.ID,
},
&Message{
{
ID: "test-3",
LocalChatID: chat2.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1247,7 +1247,7 @@ func (s *MessengerSuite) TestBlockContact() {
Seen: false,
From: "test",
},
&Message{
{
ID: "test-4",
LocalChatID: chat2.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1258,7 +1258,7 @@ func (s *MessengerSuite) TestBlockContact() {
Seen: false,
From: "test",
},
&Message{
{
ID: "test-5",
LocalChatID: chat2.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1269,7 +1269,7 @@ func (s *MessengerSuite) TestBlockContact() {
Seen: true,
From: "test",
},
&Message{
{
ID: "test-6",
LocalChatID: chat3.ID,
ChatMessage: protobuf.ChatMessage{
Expand All @@ -1280,7 +1280,7 @@ func (s *MessengerSuite) TestBlockContact() {
Seen: false,
From: contact.ID,
},
&Message{
{
ID: "test-7",
LocalChatID: chat3.ID,
ChatMessage: protobuf.ChatMessage{
Expand Down Expand Up @@ -1346,12 +1346,12 @@ func (s *MessengerSuite) TestContactPersistence() {
LastUpdated: 20,
SystemTags: []string{"1", "2"},
DeviceInfo: []ContactDeviceInfo{
ContactDeviceInfo{
{
InstallationID: "1",
Timestamp: 2,
FCMToken: "token",
},
ContactDeviceInfo{
{
InstallationID: "2",
Timestamp: 3,
FCMToken: "token-2",
Expand Down Expand Up @@ -1388,17 +1388,17 @@ func (s *MessengerSuite) TestVerifyENSNames() {
PublicKeyString: pk1,
},
// Not matching pk -> name
enstypes.ENSDetails{
{
Name: "pedro.stateofus.eth",
PublicKeyString: pk2,
},
// Not existing name
enstypes.ENSDetails{
{
Name: "definitelynotpedro.stateofus.eth",
PublicKeyString: pk3,
},
// Malformed pk
enstypes.ENSDetails{
{
Name: "pedro.stateofus.eth",
PublicKeyString: pk4,
},
Expand Down Expand Up @@ -1454,12 +1454,12 @@ func (s *MessengerSuite) TestContactPersistenceUpdate() {
LastUpdated: 20,
SystemTags: []string{"1", "2"},
DeviceInfo: []ContactDeviceInfo{
ContactDeviceInfo{
{
InstallationID: "1",
Timestamp: 2,
FCMToken: "token",
},
ContactDeviceInfo{
{
InstallationID: "2",
Timestamp: 3,
FCMToken: "token-2",
Expand Down
2 changes: 1 addition & 1 deletion protocol/persistence_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func openTestDB() (*sql.DB, error) {
}

func insertMinimalMessage(p sqlitePersistence, id string) error {
return p.SaveMessagesLegacy([]*Message{&Message{
return p.SaveMessagesLegacy([]*Message{{
ID: id,
LocalChatID: "chat-id",
ChatMessage: protobuf.ChatMessage{Text: "some-text"},
Expand Down
4 changes: 2 additions & 2 deletions vendor/github.com/status-im/status-go/protocol/messenger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion whisper/rate_limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestPeerLimiterHandlerWithWhitelisting(t *testing.T) {
LimitPerSecIP: 1,
LimitPerSecPeerID: 1,
WhitelistedIPs: []string{"<nil>"}, // no IP is represented as <nil> string
WhitelistedPeerIDs: []enode.ID{enode.ID{0xaa, 0xbb, 0xcc}},
WhitelistedPeerIDs: []enode.ID{{0xaa, 0xbb, 0xcc}},
}, h)
p := &Peer{
peer: p2p.NewPeer(enode.ID{0xaa, 0xbb, 0xcc}, "test-peer", nil),
Expand Down