From 6f4f57b7a8afb822bc156929fb637ca5e39dc081 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Mon, 28 Aug 2023 10:43:09 +0100 Subject: [PATCH] Handle nil error on request to join --- go.mod | 2 +- go.sum | 4 ++-- protocol/communities/manager.go | 2 +- .../waku-org/go-waku/waku/v2/protocol/filter/client.go | 2 +- vendor/modules.txt | 2 +- wakuv2/waku.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 4a709d6b1..c1e68e633 100644 --- a/go.mod +++ b/go.mod @@ -84,7 +84,7 @@ require ( github.com/mutecomm/go-sqlcipher/v4 v4.4.2 github.com/schollz/peerdiscovery v1.7.0 github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 - github.com/waku-org/go-waku v0.7.1-0.20230828083559-67d0b77147e4 + github.com/waku-org/go-waku v0.7.1-0.20230829115339-8ad08d6b0481 github.com/wk8/go-ordered-map/v2 v2.1.7 github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1 diff --git a/go.sum b/go.sum index 141efefba..e9f2a0897 100644 --- a/go.sum +++ b/go.sum @@ -2094,8 +2094,8 @@ github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 h1:xwY0kW5XZF github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04= -github.com/waku-org/go-waku v0.7.1-0.20230828083559-67d0b77147e4 h1:LZiocmvEy+PydFBO5y+i6MpTtPtdVMR5YGPOGAyzgWw= -github.com/waku-org/go-waku v0.7.1-0.20230828083559-67d0b77147e4/go.mod h1:egMHn9evnHqNTzc7eeGBKxNfv31PleuDjgLUfPrj40o= +github.com/waku-org/go-waku v0.7.1-0.20230829115339-8ad08d6b0481 h1:g+yGK715lZX7fqAjXDi3txAeEq6SjC0lyXliWe0emfA= +github.com/waku-org/go-waku v0.7.1-0.20230829115339-8ad08d6b0481/go.mod h1:egMHn9evnHqNTzc7eeGBKxNfv31PleuDjgLUfPrj40o= github.com/waku-org/go-zerokit-rln v0.1.14-0.20230823150836-a706089284fe h1:t2KJU5HRgmRHo94cFwSa7BDwVioj+LCjJIK1H4p2lBA= github.com/waku-org/go-zerokit-rln v0.1.14-0.20230823150836-a706089284fe/go.mod h1:aAlHP2G8TiZX5nKvsPpnOL+IGLlkYA567h5xrGCz7s8= github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230821155521-70f1ff564bae h1:VXgstV6RFUs6L/x0Xad4s0BIJ8hVEv1pyrByYzvZdT0= diff --git a/protocol/communities/manager.go b/protocol/communities/manager.go index 87dcadb48..642928175 100644 --- a/protocol/communities/manager.go +++ b/protocol/communities/manager.go @@ -2187,7 +2187,7 @@ func (m *Manager) HandleCommunityRequestToJoin(signer *ecdsa.PublicKey, request if !permissionsSatisfied { requestToJoin.State = RequestToJoinStateDeclined } - if permissionsSatisfied && existingRequestToJoin.State == RequestToJoinStateAcceptedPending { + if permissionsSatisfied && existingRequestToJoin != nil && existingRequestToJoin.State == RequestToJoinStateAcceptedPending { err = m.markRequestToJoin(signer, community) if err != nil { return nil, err diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/client.go b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/client.go index 6f59c655c..f2787269c 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/client.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/client.go @@ -379,7 +379,7 @@ func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter Co localWg.Wait() close(resultChan) for _, peerID := range peersUnsubscribed { - if len(wf.subscriptions.items[peerID].subscriptionsPerTopic) == 0 { + if wf.subscriptions != nil && wf.subscriptions.items != nil && wf.subscriptions.items[peerID] != nil && len(wf.subscriptions.items[peerID].subscriptionsPerTopic) == 0 { delete(wf.subscriptions.items, peerID) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index ecd827982..8e9932b81 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1008,7 +1008,7 @@ github.com/waku-org/go-discover/discover/v5wire github.com/waku-org/go-libp2p-rendezvous github.com/waku-org/go-libp2p-rendezvous/db github.com/waku-org/go-libp2p-rendezvous/pb -# github.com/waku-org/go-waku v0.7.1-0.20230828083559-67d0b77147e4 +# github.com/waku-org/go-waku v0.7.1-0.20230829115339-8ad08d6b0481 ## explicit; go 1.19 github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/waku/persistence diff --git a/wakuv2/waku.go b/wakuv2/waku.go index 36d4bc6bd..347933526 100644 --- a/wakuv2/waku.go +++ b/wakuv2/waku.go @@ -1181,7 +1181,7 @@ func (w *Waku) query(ctx context.Context, peerID peer.ID, pubsubTopic string, to func (w *Waku) Query(ctx context.Context, peerID peer.ID, pubsubTopic string, topics []common.TopicType, from uint64, to uint64, opts []store.HistoryRequestOption) (cursor *storepb.Index, err error) { requestID := protocol.GenerateRequestId() - opts = append(opts, store.WithRequestId(requestID)) + opts = append(opts, store.WithRequestID(requestID)) result, err := w.query(ctx, peerID, pubsubTopic, topics, from, to, opts) if err != nil { w.logger.Error("error querying storenode", zap.String("requestID", hexutil.Encode(requestID)), zap.String("peerID", peerID.String()), zap.Error(err))