mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-27 05:56:07 +00:00
refactor: reuse query and cursor instead of specifying each pb field (#937)
This commit is contained in:
parent
e0be9857ef
commit
b7105f9b9f
@ -452,23 +452,9 @@ func (store *WakuStore) Next(ctx context.Context, r *Result) (*Result, error) {
|
||||
|
||||
historyRequest := &pb.HistoryRPC{
|
||||
RequestId: hex.EncodeToString(protocol.GenerateRequestID()),
|
||||
Query: &pb.HistoryQuery{
|
||||
PubsubTopic: r.Query().PubsubTopic,
|
||||
ContentFilters: r.Query().ContentFilters,
|
||||
StartTime: r.Query().StartTime,
|
||||
EndTime: r.Query().EndTime,
|
||||
PagingInfo: &pb.PagingInfo{
|
||||
PageSize: r.Query().PagingInfo.PageSize,
|
||||
Direction: r.Query().PagingInfo.Direction,
|
||||
Cursor: &pb.Index{
|
||||
Digest: r.Cursor().Digest,
|
||||
ReceiverTime: r.Cursor().ReceiverTime,
|
||||
SenderTime: r.Cursor().SenderTime,
|
||||
PubsubTopic: r.Cursor().PubsubTopic,
|
||||
},
|
||||
},
|
||||
},
|
||||
Query: r.Query(),
|
||||
}
|
||||
historyRequest.Query.PagingInfo.Cursor = r.Cursor()
|
||||
|
||||
response, err := store.queryFrom(ctx, historyRequest, r.PeerID())
|
||||
if err != nil {
|
||||
|
@ -79,7 +79,7 @@ func TestWakuStoreProtocolQuery(t *testing.T) {
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Len(t, response.Messages, 1)
|
||||
require.Equal(t, msg, response.Messages[0])
|
||||
require.True(t, proto.Equal(msg, response.Messages[0]))
|
||||
}
|
||||
|
||||
func TestWakuStoreProtocolLocalQuery(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user