From ad1b0948e37305c78e1a94a61e5c5f8e981c884d Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 5 Jun 2024 11:42:27 -0400 Subject: [PATCH] fix(storev3): cursor --- waku/v2/protocol/store/result.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/waku/v2/protocol/store/result.go b/waku/v2/protocol/store/result.go index 0b3cb36f..5ea4765e 100644 --- a/waku/v2/protocol/store/result.go +++ b/waku/v2/protocol/store/result.go @@ -9,8 +9,7 @@ import ( // Result represents a valid response from a store node type Result struct { - noCursor bool - done bool + done bool messages []*pb.WakuMessageKeyValue store *WakuStore @@ -25,7 +24,7 @@ func (r *Result) Cursor() []byte { } func (r *Result) IsComplete() bool { - return r.noCursor && r.done + return r.done } func (r *Result) PeerID() peer.ID { @@ -41,7 +40,7 @@ func (r *Result) Response() *pb.StoreQueryResponse { } func (r *Result) Next(ctx context.Context) error { - if r.noCursor { + if r.cursor == nil { r.done = true r.messages = nil return nil @@ -55,10 +54,6 @@ func (r *Result) Next(ctx context.Context) error { r.cursor = newResult.cursor r.messages = newResult.messages - if r.cursor == nil { - r.noCursor = true - } - return nil }