Handle nil error on request to join

This commit is contained in:
Andrea Maria Piana 2023-08-28 10:43:09 +01:00
parent 8c41678520
commit 6f4f57b7a8
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
6 changed files with 7 additions and 7 deletions

2
go.mod
View File

@ -84,7 +84,7 @@ require (
github.com/mutecomm/go-sqlcipher/v4 v4.4.2 github.com/mutecomm/go-sqlcipher/v4 v4.4.2
github.com/schollz/peerdiscovery v1.7.0 github.com/schollz/peerdiscovery v1.7.0
github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 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/wk8/go-ordered-map/v2 v2.1.7
github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/v2 v2.2.1
github.com/yeqown/go-qrcode/writer/standard v1.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1

4
go.sum
View File

@ -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-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 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE=
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04= 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.20230829115339-8ad08d6b0481 h1:g+yGK715lZX7fqAjXDi3txAeEq6SjC0lyXliWe0emfA=
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/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 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 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= github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230821155521-70f1ff564bae h1:VXgstV6RFUs6L/x0Xad4s0BIJ8hVEv1pyrByYzvZdT0=

View File

@ -2187,7 +2187,7 @@ func (m *Manager) HandleCommunityRequestToJoin(signer *ecdsa.PublicKey, request
if !permissionsSatisfied { if !permissionsSatisfied {
requestToJoin.State = RequestToJoinStateDeclined requestToJoin.State = RequestToJoinStateDeclined
} }
if permissionsSatisfied && existingRequestToJoin.State == RequestToJoinStateAcceptedPending { if permissionsSatisfied && existingRequestToJoin != nil && existingRequestToJoin.State == RequestToJoinStateAcceptedPending {
err = m.markRequestToJoin(signer, community) err = m.markRequestToJoin(signer, community)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -379,7 +379,7 @@ func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter Co
localWg.Wait() localWg.Wait()
close(resultChan) close(resultChan)
for _, peerID := range peersUnsubscribed { 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) delete(wf.subscriptions.items, peerID)
} }
} }

2
vendor/modules.txt vendored
View File

@ -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
github.com/waku-org/go-libp2p-rendezvous/db github.com/waku-org/go-libp2p-rendezvous/db
github.com/waku-org/go-libp2p-rendezvous/pb 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 ## explicit; go 1.19
github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/logging
github.com/waku-org/go-waku/waku/persistence github.com/waku-org/go-waku/waku/persistence

View File

@ -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) { 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() 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) result, err := w.query(ctx, peerID, pubsubTopic, topics, from, to, opts)
if err != nil { if err != nil {
w.logger.Error("error querying storenode", zap.String("requestID", hexutil.Encode(requestID)), zap.String("peerID", peerID.String()), zap.Error(err)) w.logger.Error("error querying storenode", zap.String("requestID", hexutil.Encode(requestID)), zap.String("peerID", peerID.String()), zap.Error(err))