fix(waku)_: only use requestId in store query if defined (#5211)
This commit is contained in:
parent
cec5985066
commit
d31200e55b
|
@ -1062,7 +1062,9 @@ func (w *Waku) Send(pubsubTopic string, msg *pb.WakuMessage) ([]byte, error) {
|
|||
|
||||
func (w *Waku) query(ctx context.Context, peerID peer.ID, pubsubTopic string, topics []common.TopicType, from uint64, to uint64, requestID []byte, opts []legacy_store.HistoryRequestOption) (*legacy_store.Result, error) {
|
||||
|
||||
if len(requestID) != 0 {
|
||||
opts = append(opts, legacy_store.WithRequestID(requestID))
|
||||
}
|
||||
|
||||
strTopics := make([]string, len(topics))
|
||||
for i, t := range topics {
|
||||
|
|
|
@ -183,7 +183,16 @@ func TestBasicWakuV2(t *testing.T) {
|
|||
b.InitialInterval = 500 * time.Millisecond
|
||||
}
|
||||
err = tt.RetryWithBackOff(func() error {
|
||||
storeResult, err := w.query(context.Background(), storeNode.PeerID, relay.DefaultWakuTopic, []common.TopicType{contentTopic}, uint64(timestampInSeconds-int64(marginInSeconds)), uint64(timestampInSeconds+int64(marginInSeconds)), []byte{}, []legacy_store.HistoryRequestOption{})
|
||||
storeResult, err := w.query(
|
||||
context.Background(),
|
||||
storeNode.PeerID,
|
||||
relay.DefaultWakuTopic,
|
||||
[]common.TopicType{contentTopic},
|
||||
uint64(timestampInSeconds-int64(marginInSeconds)),
|
||||
uint64(timestampInSeconds+int64(marginInSeconds)),
|
||||
[]byte{},
|
||||
[]legacy_store.HistoryRequestOption{},
|
||||
)
|
||||
if err != nil || len(storeResult.Messages) == 0 {
|
||||
// in case of failure extend timestamp margin up to 40secs
|
||||
if marginInSeconds < 40 {
|
||||
|
@ -461,7 +470,16 @@ func TestWakuV2Store(t *testing.T) {
|
|||
marginInSeconds := 5
|
||||
|
||||
// Query the second node's store for the message
|
||||
storeResult, err := w1.query(context.Background(), w2.node.Host().ID(), relay.DefaultWakuTopic, []common.TopicType{contentTopic}, uint64(timestampInSeconds-int64(marginInSeconds)), uint64(timestampInSeconds+int64(marginInSeconds)), []byte{}, []legacy_store.HistoryRequestOption{})
|
||||
storeResult, err := w1.query(
|
||||
context.Background(),
|
||||
w2.node.Host().ID(),
|
||||
relay.DefaultWakuTopic,
|
||||
[]common.TopicType{contentTopic},
|
||||
uint64(timestampInSeconds-int64(marginInSeconds)),
|
||||
uint64(timestampInSeconds+int64(marginInSeconds)),
|
||||
[]byte{},
|
||||
[]legacy_store.HistoryRequestOption{},
|
||||
)
|
||||
require.NoError(t, err)
|
||||
require.True(t, len(storeResult.Messages) > 0, "no messages received from store node")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue