[Fixes: #2068] Pass topics for mailserver
We were not actually passing the topics in the request, therefore we were using bloom filter for query, which resulted in long syncing times for some users.
This commit is contained in:
parent
d8307a60cf
commit
0304b3fa46
|
@ -597,9 +597,12 @@ func MakeMessagesRequestPayload(r MessagesRequest) ([]byte, error) {
|
|||
}
|
||||
|
||||
payload := mailserver.MessagesRequestPayload{
|
||||
Lower: r.From,
|
||||
Upper: r.To,
|
||||
Lower: r.From,
|
||||
Upper: r.To,
|
||||
// We need to pass bloom filter for
|
||||
// backward compatibility
|
||||
Bloom: createBloomFilter(r),
|
||||
Topics: topicsToByteArray(r.Topics),
|
||||
Limit: r.Limit,
|
||||
Cursor: cursor,
|
||||
// Client must tell the MailServer if it supports batch responses.
|
||||
|
@ -610,6 +613,16 @@ func MakeMessagesRequestPayload(r MessagesRequest) ([]byte, error) {
|
|||
return rlp.EncodeToBytes(payload)
|
||||
}
|
||||
|
||||
func topicsToByteArray(topics []types.TopicType) [][]byte {
|
||||
|
||||
var response [][]byte
|
||||
for idx := range topics {
|
||||
response = append(response, topics[idx][:])
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
func createBloomFilter(r MessagesRequest) []byte {
|
||||
if len(r.Topics) > 0 {
|
||||
return topicsToBloom(r.Topics...)
|
||||
|
|
Loading…
Reference in New Issue