led comments to the standard

This commit is contained in:
Evgeny Danienko 2018-03-26 20:05:24 +03:00
parent a90be3c0de
commit b9598a1a31
No known key found for this signature in database
GPG Key ID: BC8C34D8B45BECBF

View File

@ -28,7 +28,7 @@ func TestWhisperMailboxTestSuite(t *testing.T) {
} }
func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() { func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
//Start mailbox and status node // Start mailbox and status node.
mailboxBackend, stop := s.startMailboxBackend() mailboxBackend, stop := s.startMailboxBackend()
defer stop() defer stop()
mailboxNode, err := mailboxBackend.NodeManager().Node() mailboxNode, err := mailboxBackend.NodeManager().Node()
@ -44,13 +44,13 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
err = sender.NodeManager().AddPeer(mailboxEnode) err = sender.NodeManager().AddPeer(mailboxEnode)
s.Require().NoError(err) s.Require().NoError(err)
//wait async processes on adding peer // Wait async processes on adding peer.
time.Sleep(time.Second) time.Sleep(time.Second)
senderWhisperService, err := sender.NodeManager().WhisperService() senderWhisperService, err := sender.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
//Mark mailbox node trusted // Mark mailbox node trusted.
parsedNode, err := discover.ParseNode(mailboxNode.Server().NodeInfo().Enode) parsedNode, err := discover.ParseNode(mailboxNode.Server().NodeInfo().Enode)
s.Require().NoError(err) s.Require().NoError(err)
mailboxPeer := parsedNode.ID[:] mailboxPeer := parsedNode.ID[:]
@ -58,7 +58,7 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
err = senderWhisperService.AllowP2PMessagesFromPeer(mailboxPeer) err = senderWhisperService.AllowP2PMessagesFromPeer(mailboxPeer)
s.Require().NoError(err) s.Require().NoError(err)
//Generate mailbox symkey // Generate mailbox symkey.
password := "status-offline-inbox" password := "status-offline-inbox"
MailServerKeyID, err := senderWhisperService.AddSymKeyFromPassword(password) MailServerKeyID, err := senderWhisperService.AddSymKeyFromPassword(password)
s.Require().NoError(err) s.Require().NoError(err)
@ -66,34 +66,34 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
rpcClient := sender.NodeManager().RPCClient() rpcClient := sender.NodeManager().RPCClient()
s.Require().NotNil(rpcClient) s.Require().NotNil(rpcClient)
//create topic // Create topic.
topic := whisper.BytesToTopic([]byte("topic name")) topic := whisper.BytesToTopic([]byte("topic name"))
//Add key pair to whisper // Add key pair to whisper.
keyID, err := senderWhisperService.NewKeyPair() keyID, err := senderWhisperService.NewKeyPair()
s.Require().NoError(err) s.Require().NoError(err)
key, err := senderWhisperService.GetPrivateKey(keyID) key, err := senderWhisperService.GetPrivateKey(keyID)
s.Require().NoError(err) s.Require().NoError(err)
pubkey := hexutil.Bytes(crypto.FromECDSAPub(&key.PublicKey)) pubkey := hexutil.Bytes(crypto.FromECDSAPub(&key.PublicKey))
//Create message filter // Create message filter.
messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String()) messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String())
//Threre are no messages at filter // There are no messages at filter.
messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID) messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//Post message matching with filter (key and token) // Post message matching with filter (key and token).
s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!"))) s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!")))
//Get message to make sure that it will come from the mailbox later // Get message to make sure that it will come from the mailbox later.
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
//act // Act.
//Request messages (including the previous one, expired) from mailbox // Request messages (including the previous one, expired) from mailbox.
reqMessagesBody := `{ reqMessagesBody := `{
"jsonrpc": "2.0", "jsonrpc": "2.0",
"id": 1, "id": 1,
@ -112,19 +112,19 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Nil(reqMessagesResp.Error) s.Require().Nil(reqMessagesResp.Error)
//wait to receive message // Wait to receive message.
time.Sleep(time.Second) time.Sleep(time.Second)
//And we receive message, it comes from mailbox // And we receive message, it comes from mailbox.
messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
//check that there are no messages // Check that there are no messages.
messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
} }
func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() { func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
//Start mailbox, alice, bob, charlie node // Start mailbox, alice, bob, charlie node.
mailboxBackend, stop := s.startMailboxBackend() mailboxBackend, stop := s.startMailboxBackend()
defer stop() defer stop()
@ -137,7 +137,7 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
charlieBackend, stop := s.startBackend("charlie") charlieBackend, stop := s.startBackend("charlie")
defer stop() defer stop()
//add mailbox to static peers // Add mailbox to static peers.
mailboxNode, err := mailboxBackend.NodeManager().Node() mailboxNode, err := mailboxBackend.NodeManager().Node()
s.Require().NoError(err) s.Require().NoError(err)
mailboxEnode := mailboxNode.Server().NodeInfo().Enode mailboxEnode := mailboxNode.Server().NodeInfo().Enode
@ -148,40 +148,40 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
s.Require().NoError(err) s.Require().NoError(err)
err = charlieBackend.NodeManager().AddPeer(mailboxEnode) err = charlieBackend.NodeManager().AddPeer(mailboxEnode)
s.Require().NoError(err) s.Require().NoError(err)
//wait async processes on adding peer // Wait async processes on adding peer.
time.Sleep(time.Second) time.Sleep(time.Second)
//get whisper service // Get whisper service.
aliceWhisperService, err := aliceBackend.NodeManager().WhisperService() aliceWhisperService, err := aliceBackend.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
bobWhisperService, err := bobBackend.NodeManager().WhisperService() bobWhisperService, err := bobBackend.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
charlieWhisperService, err := charlieBackend.NodeManager().WhisperService() charlieWhisperService, err := charlieBackend.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
//get rpc client // Get rpc client.
aliceRPCClient := aliceBackend.NodeManager().RPCClient() aliceRPCClient := aliceBackend.NodeManager().RPCClient()
bobRPCClient := bobBackend.NodeManager().RPCClient() bobRPCClient := bobBackend.NodeManager().RPCClient()
charlieRPCClient := charlieBackend.NodeManager().RPCClient() charlieRPCClient := charlieBackend.NodeManager().RPCClient()
//bob and charlie add mailserver key // Bob and charlie add the mailserver key.
password := "status-offline-inbox" password := "status-offline-inbox"
bobMailServerKeyID, err := bobWhisperService.AddSymKeyFromPassword(password) bobMailServerKeyID, err := bobWhisperService.AddSymKeyFromPassword(password)
s.Require().NoError(err) s.Require().NoError(err)
charlieMailServerKeyID, err := charlieWhisperService.AddSymKeyFromPassword(password) charlieMailServerKeyID, err := charlieWhisperService.AddSymKeyFromPassword(password)
s.Require().NoError(err) s.Require().NoError(err)
//generate group chat symkey and topic // Generate a group chat symkey and topic.
groupChatKeyID, err := aliceWhisperService.GenerateSymKey() groupChatKeyID, err := aliceWhisperService.GenerateSymKey()
s.Require().NoError(err) s.Require().NoError(err)
groupChatKey, err := aliceWhisperService.GetSymKey(groupChatKeyID) groupChatKey, err := aliceWhisperService.GetSymKey(groupChatKeyID)
s.Require().NoError(err) s.Require().NoError(err)
//generate group chat topic // Generate a group chat topic.
groupChatTopic := whisper.BytesToTopic([]byte("groupChatTopic")) groupChatTopic := whisper.BytesToTopic([]byte("groupChatTopic"))
groupChatPayload := newGroupChatParams(groupChatKey, groupChatTopic) groupChatPayload := newGroupChatParams(groupChatKey, groupChatTopic)
payloadStr, err := groupChatPayload.Encode() payloadStr, err := groupChatPayload.Encode()
s.Require().NoError(err) s.Require().NoError(err)
//Add bob and charlie create key pairs to receive symmetric key for group chat from alice // Add Bob and Charlie's key pairs to receive the symmetric key for the group chat from Alice.
bobKeyID, err := bobWhisperService.NewKeyPair() bobKeyID, err := bobWhisperService.NewKeyPair()
s.Require().NoError(err) s.Require().NoError(err)
bobKey, err := bobWhisperService.GetPrivateKey(bobKeyID) bobKey, err := bobWhisperService.GetPrivateKey(bobKeyID)
@ -196,19 +196,19 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
charliePubkey := hexutil.Bytes(crypto.FromECDSAPub(&charlieKey.PublicKey)) charliePubkey := hexutil.Bytes(crypto.FromECDSAPub(&charlieKey.PublicKey))
charlieAliceKeySendTopic := whisper.BytesToTopic([]byte("charlieAliceKeySendTopic ")) charlieAliceKeySendTopic := whisper.BytesToTopic([]byte("charlieAliceKeySendTopic "))
//bob and charlie create message filter // Bob and charlie create message filter.
bobMessageFilterID := s.createPrivateChatMessageFilter(bobRPCClient, bobKeyID, bobAliceKeySendTopic.String()) bobMessageFilterID := s.createPrivateChatMessageFilter(bobRPCClient, bobKeyID, bobAliceKeySendTopic.String())
charlieMessageFilterID := s.createPrivateChatMessageFilter(charlieRPCClient, charlieKeyID, charlieAliceKeySendTopic.String()) charlieMessageFilterID := s.createPrivateChatMessageFilter(charlieRPCClient, charlieKeyID, charlieAliceKeySendTopic.String())
//Alice send message with symkey and topic to bob and charlie // Alice send message with symkey and topic to Bob and Charlie.
s.postMessageToPrivate(aliceRPCClient, bobPubkey.String(), bobAliceKeySendTopic.String(), payloadStr) s.postMessageToPrivate(aliceRPCClient, bobPubkey.String(), bobAliceKeySendTopic.String(), payloadStr)
s.postMessageToPrivate(aliceRPCClient, charliePubkey.String(), charlieAliceKeySendTopic.String(), payloadStr) s.postMessageToPrivate(aliceRPCClient, charliePubkey.String(), charlieAliceKeySendTopic.String(), payloadStr)
//wait to receive // Wait to receive.
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
//bob receive group chat data and add it to his node // Bob receive group chat data and add it to his node.
//1. bob get group chat details // Bob get group chat details.
messages := s.getMessagesByMessageFilterID(bobRPCClient, bobMessageFilterID) messages := s.getMessagesByMessageFilterID(bobRPCClient, bobMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
bobGroupChatData := groupChatParams{} bobGroupChatData := groupChatParams{}
@ -216,15 +216,15 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
s.Require().NoError(err) s.Require().NoError(err)
s.EqualValues(groupChatPayload, bobGroupChatData) s.EqualValues(groupChatPayload, bobGroupChatData)
//2. bob add symkey to his node // Bob add symkey to his node.
bobGroupChatSymkeyID := s.addSymKey(bobRPCClient, bobGroupChatData.Key) bobGroupChatSymkeyID := s.addSymKey(bobRPCClient, bobGroupChatData.Key)
s.Require().NotEmpty(bobGroupChatSymkeyID) s.Require().NotEmpty(bobGroupChatSymkeyID)
//3. bob create message filter to node by group chat topic // Bob create message filter to node by group chat topic.
bobGroupChatMessageFilterID := s.createGroupChatMessageFilter(bobRPCClient, bobGroupChatSymkeyID, bobGroupChatData.Topic) bobGroupChatMessageFilterID := s.createGroupChatMessageFilter(bobRPCClient, bobGroupChatSymkeyID, bobGroupChatData.Topic)
//charlie receive group chat data and add it to his node // Charlie receive group chat data and add it to his node.
//1. charlie get group chat details // Charlie get group chat details.
messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
charlieGroupChatData := groupChatParams{} charlieGroupChatData := groupChatParams{}
@ -232,45 +232,47 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
s.Require().NoError(err) s.Require().NoError(err)
s.EqualValues(groupChatPayload, charlieGroupChatData) s.EqualValues(groupChatPayload, charlieGroupChatData)
//2. charlie add symkey to his node // Charlie add symkey to his node.
charlieGroupChatSymkeyID := s.addSymKey(charlieRPCClient, charlieGroupChatData.Key) charlieGroupChatSymkeyID := s.addSymKey(charlieRPCClient, charlieGroupChatData.Key)
s.Require().NotEmpty(charlieGroupChatSymkeyID) s.Require().NotEmpty(charlieGroupChatSymkeyID)
//3. charlie create message filter to node by group chat topic // Charlie create message filter to node by group chat topic.
charlieGroupChatMessageFilterID := s.createGroupChatMessageFilter(charlieRPCClient, charlieGroupChatSymkeyID, charlieGroupChatData.Topic) charlieGroupChatMessageFilterID := s.createGroupChatMessageFilter(charlieRPCClient, charlieGroupChatSymkeyID, charlieGroupChatData.Topic)
//alice send message to group chat // Alice send message to group chat.
helloWorldMessage := hexutil.Encode([]byte("Hello world!")) helloWorldMessage := hexutil.Encode([]byte("Hello world!"))
s.postMessageToGroup(aliceRPCClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage) s.postMessageToGroup(aliceRPCClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage)
time.Sleep(5 * time.Second) //it need to receive envelopes by bob and charlie nodes // It need to receive envelopes by bob and charlie nodes.
time.Sleep(5 * time.Second)
//bob receive group chat message // Bob receive group chat message.
messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//charlie receive group chat message // Charlie receive group chat message.
messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//check that we don't receive messages each one time // Check that we don't receive messages each one time.
messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//Request each one messages from mailbox using enode // Request each one messages from mailbox using enode.
s.requestHistoricMessages(bobRPCClient, mailboxEnode, bobMailServerKeyID, groupChatTopic.String()) s.requestHistoricMessages(bobRPCClient, mailboxEnode, bobMailServerKeyID, groupChatTopic.String())
s.requestHistoricMessages(charlieRPCClient, mailboxEnode, charlieMailServerKeyID, groupChatTopic.String()) s.requestHistoricMessages(charlieRPCClient, mailboxEnode, charlieMailServerKeyID, groupChatTopic.String())
time.Sleep(5 * time.Second) //wait to receive p2p messages // Wait to receive p2p messages.
time.Sleep(5 * time.Second)
//bob receive p2p message from grop chat filter // Bob receive p2p message from group chat filter.
messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//charlie receive p2p message from grop chat filter // Charlie receive p2p message from group chat filter.
messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
@ -280,22 +282,24 @@ func (s *WhisperMailboxSuite) TestSendMessageWithoutSubscription() {
aliceBackend, stop := s.startBackend("alice") aliceBackend, stop := s.startBackend("alice")
defer stop() defer stop()
// we need to wait >= whisper.DefaultSyncAllowance seconds to update Bloom filter tolerated // We need to wait >= whisper.DefaultSyncAllowance seconds to update Bloom filter tolerated.
time.Sleep((whisper.DefaultSyncAllowance + 1) * time.Second) time.Sleep((whisper.DefaultSyncAllowance + 1) * time.Second)
//get whisper service // Get whisper service.
aliceWhisperService, err := aliceBackend.NodeManager().WhisperService() aliceWhisperService, err := aliceBackend.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
//get rpc client
// Get rpc client.
aliceRPCClient := aliceBackend.NodeManager().RPCClient() aliceRPCClient := aliceBackend.NodeManager().RPCClient()
//generate group chat symkey and topic // Generate group chat symkey and topic.
groupChatKeyID, err := aliceWhisperService.GenerateSymKey() groupChatKeyID, err := aliceWhisperService.GenerateSymKey()
s.Require().NoError(err) s.Require().NoError(err)
//generate group chat topic
// Generate group chat topic.
groupChatTopic := whisper.BytesToTopic([]byte("groupChatTopic")) groupChatTopic := whisper.BytesToTopic([]byte("groupChatTopic"))
//alice send message to group chat // Alice send message to group chat.
helloWorldMessage := hexutil.Encode([]byte("Hello world!")) helloWorldMessage := hexutil.Encode([]byte("Hello world!"))
s.postMessageToGroup(aliceRPCClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage) s.postMessageToGroup(aliceRPCClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage)
} }
@ -329,7 +333,7 @@ func (d *groupChatParams) Encode() (string, error) {
return hexutil.Bytes(payload).String(), nil return hexutil.Bytes(payload).String(), nil
} }
//Start status node // Start status node.
func (s *WhisperMailboxSuite) startBackend(name string) (*api.StatusBackend, func()) { func (s *WhisperMailboxSuite) startBackend(name string) (*api.StatusBackend, func()) {
datadir := filepath.Join(RootDir, ".ethereumtest/mailbox", name) datadir := filepath.Join(RootDir, ".ethereumtest/mailbox", name)
backend := api.NewStatusBackend() backend := api.NewStatusBackend()
@ -358,7 +362,7 @@ func (s *WhisperMailboxSuite) startBackend(name string) (*api.StatusBackend, fun
} }
//Start mailbox node // Start mailbox node.
func (s *WhisperMailboxSuite) startMailboxBackend() (*api.StatusBackend, func()) { func (s *WhisperMailboxSuite) startMailboxBackend() (*api.StatusBackend, func()) {
mailboxBackend := api.NewStatusBackend() mailboxBackend := api.NewStatusBackend()
mailboxConfig, err := MakeTestNodeConfig(GetNetworkID()) mailboxConfig, err := MakeTestNodeConfig(GetNetworkID())
@ -385,7 +389,7 @@ func (s *WhisperMailboxSuite) startMailboxBackend() (*api.StatusBackend, func())
} }
} }
//createPrivateChatMessageFilter create message filter with asymmetric encryption // createPrivateChatMessageFilter create message filter with asymmetric encryption.
func (s *WhisperMailboxSuite) createPrivateChatMessageFilter(rpcCli *rpc.Client, privateKeyID string, topic string) string { func (s *WhisperMailboxSuite) createPrivateChatMessageFilter(rpcCli *rpc.Client, privateKeyID string, topic string) string {
resp := rpcCli.CallRaw(`{ resp := rpcCli.CallRaw(`{
"jsonrpc": "2.0", "jsonrpc": "2.0",
@ -404,7 +408,7 @@ func (s *WhisperMailboxSuite) createPrivateChatMessageFilter(rpcCli *rpc.Client,
return messageFilterID return messageFilterID
} }
//createGroupChatMessageFilter create message filter with symmetric encryption // createGroupChatMessageFilter create message filter with symmetric encryption.
func (s *WhisperMailboxSuite) createGroupChatMessageFilter(rpcCli *rpc.Client, symkeyID string, topic string) string { func (s *WhisperMailboxSuite) createGroupChatMessageFilter(rpcCli *rpc.Client, symkeyID string, topic string) string {
resp := rpcCli.CallRaw(`{ resp := rpcCli.CallRaw(`{
"jsonrpc": "2.0", "jsonrpc": "2.0",
@ -463,7 +467,7 @@ func (s *WhisperMailboxSuite) postMessageToGroup(rpcCli *rpc.Client, groupChatKe
s.Require().Nil(postResp.Error) s.Require().Nil(postResp.Error)
} }
//getMessagesByMessageFilterID get received messages by messageFilterID // getMessagesByMessageFilterID gets received messages by messageFilterID.
func (s *WhisperMailboxSuite) getMessagesByMessageFilterID(rpcCli *rpc.Client, messageFilterID string) []map[string]interface{} { func (s *WhisperMailboxSuite) getMessagesByMessageFilterID(rpcCli *rpc.Client, messageFilterID string) []map[string]interface{} {
resp := rpcCli.CallRaw(`{ resp := rpcCli.CallRaw(`{
"jsonrpc": "2.0", "jsonrpc": "2.0",
@ -477,7 +481,7 @@ func (s *WhisperMailboxSuite) getMessagesByMessageFilterID(rpcCli *rpc.Client, m
return messages.Result return messages.Result
} }
//addSymKey added symkey to node and return symkeyID // addSymKey added symkey to node and return symkeyID.
func (s *WhisperMailboxSuite) addSymKey(rpcCli *rpc.Client, symkey string) string { func (s *WhisperMailboxSuite) addSymKey(rpcCli *rpc.Client, symkey string) string {
resp := rpcCli.CallRaw(`{"jsonrpc":"2.0","method":"shh_addSymKey", resp := rpcCli.CallRaw(`{"jsonrpc":"2.0","method":"shh_addSymKey",
"params":["` + symkey + `"], "params":["` + symkey + `"],
@ -491,7 +495,7 @@ func (s *WhisperMailboxSuite) addSymKey(rpcCli *rpc.Client, symkey string) strin
return symkeyID return symkeyID
} }
//requestHistoricMessages ask mailnode to resend messagess // requestHistoricMessages asks a mailnode to resend messages.
func (s *WhisperMailboxSuite) requestHistoricMessages(rpcCli *rpc.Client, mailboxEnode, mailServerKeyID, topic string) { func (s *WhisperMailboxSuite) requestHistoricMessages(rpcCli *rpc.Client, mailboxEnode, mailServerKeyID, topic string) {
resp := rpcCli.CallRaw(`{ resp := rpcCli.CallRaw(`{
"jsonrpc": "2.0", "jsonrpc": "2.0",