diff --git a/waku/node.go b/waku/node.go index dadbee7f..d44c5d34 100644 --- a/waku/node.go +++ b/waku/node.go @@ -214,7 +214,7 @@ func Execute(options Options) { failOnErr(err, "Wakunode") addPeers(wakuNode, options.Rendezvous.Nodes.Value(), rendezvous.RendezvousID_v001) - addPeers(wakuNode, options.Store.Nodes.Value(), store.StoreID_v20beta3) + addPeers(wakuNode, options.Store.Nodes.Value(), store.StoreID_v20beta4) addPeers(wakuNode, options.LightPush.Nodes.Value(), lightpush.LightPushID_v20beta1) addPeers(wakuNode, options.Filter.Nodes.Value(), filter.FilterID_v20beta1) diff --git a/waku/v2/node/connectedness.go b/waku/v2/node/connectedness.go index d7a27cc6..5b9bf975 100644 --- a/waku/v2/node/connectedness.go +++ b/waku/v2/node/connectedness.go @@ -122,7 +122,7 @@ func (w *WakuNode) Status() (isOnline bool, hasHistory bool) { if !hasLightPush && protocol == string(lightpush.LightPushID_v20beta1) { hasLightPush = true } - if !hasStore && protocol == string(store.StoreID_v20beta3) { + if !hasStore && protocol == string(store.StoreID_v20beta4) { hasStore = true } if !hasFilter && protocol == string(filter.FilterID_v20beta1) { diff --git a/waku/v2/node/wakunode2.go b/waku/v2/node/wakunode2.go index b8f10cdd..24e732b3 100644 --- a/waku/v2/node/wakunode2.go +++ b/waku/v2/node/wakunode2.go @@ -486,7 +486,7 @@ func (w *WakuNode) startStore() { case <-w.quit: return case <-ticker.C: - _, err := utils.SelectPeer(w.host, string(store.StoreID_v20beta3), w.log) + _, err := utils.SelectPeer(w.host, string(store.StoreID_v20beta4), w.log) if err == nil { break peerVerif } diff --git a/waku/v2/protocol/store/waku_resume_test.go b/waku/v2/protocol/store/waku_resume_test.go index c79caa77..53cca24c 100644 --- a/waku/v2/protocol/store/waku_resume_test.go +++ b/waku/v2/protocol/store/waku_resume_test.go @@ -61,7 +61,7 @@ func TestResume(t *testing.T) { defer s2.Stop() host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) - err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta3)) + err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta4)) require.NoError(t, err) msgCount, err := s2.Resume(ctx, "test", []peer.ID{host1.ID()}) @@ -104,7 +104,7 @@ func TestResumeWithListOfPeers(t *testing.T) { defer s2.Stop() host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) - err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta3)) + err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta4)) require.NoError(t, err) msgCount, err := s2.Resume(ctx, "test", []peer.ID{invalidHost.ID(), host1.ID()}) @@ -137,7 +137,7 @@ func TestResumeWithoutSpecifyingPeer(t *testing.T) { defer s2.Stop() host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) - err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta3)) + err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta4)) require.NoError(t, err) msgCount, err := s2.Resume(ctx, "test", []peer.ID{}) diff --git a/waku/v2/protocol/store/waku_store.go b/waku/v2/protocol/store/waku_store.go index 452bef0e..6b54ab82 100644 --- a/waku/v2/protocol/store/waku_store.go +++ b/waku/v2/protocol/store/waku_store.go @@ -26,8 +26,8 @@ import ( "github.com/status-im/go-waku/waku/v2/utils" ) -// StoreID_v20beta3 is the current Waku Store protocol identifier -const StoreID_v20beta3 = libp2pProtocol.ID("/vac/waku/store/2.0.0-beta4") +// StoreID_v20beta4 is the current Waku Store protocol identifier +const StoreID_v20beta4 = libp2pProtocol.ID("/vac/waku/store/2.0.0-beta4") // MaxPageSize is the maximum number of waku messages to return per page const MaxPageSize = 100 @@ -266,7 +266,7 @@ func (store *WakuStore) Start(ctx context.Context) { store.ctx = ctx store.MsgC = make(chan *protocol.Envelope, 1024) - store.h.SetStreamHandlerMatch(StoreID_v20beta3, protocol.PrefixTextMatch(string(StoreID_v20beta3)), store.onRequest) + store.h.SetStreamHandlerMatch(StoreID_v20beta4, protocol.PrefixTextMatch(string(StoreID_v20beta4)), store.onRequest) store.wg.Add(1) go store.storeIncomingMessages(ctx) @@ -446,7 +446,7 @@ func WithPeer(p peer.ID) HistoryRequestOption { // to request the message history func WithAutomaticPeerSelection() HistoryRequestOption { return func(params *HistoryRequestParameters) { - p, err := utils.SelectPeer(params.s.h, string(StoreID_v20beta3), params.s.log) + p, err := utils.SelectPeer(params.s.h, string(StoreID_v20beta4), params.s.log) if err == nil { params.selectedPeer = *p } else { @@ -457,7 +457,7 @@ func WithAutomaticPeerSelection() HistoryRequestOption { func WithFastestPeerSelection(ctx context.Context) HistoryRequestOption { return func(params *HistoryRequestParameters) { - p, err := utils.SelectPeerWithLowestRTT(ctx, params.s.h, string(StoreID_v20beta3), params.s.log) + p, err := utils.SelectPeerWithLowestRTT(ctx, params.s.h, string(StoreID_v20beta4), params.s.log) if err == nil { params.selectedPeer = *p } else { @@ -504,7 +504,7 @@ func DefaultOptions() []HistoryRequestOption { func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selectedPeer peer.ID, requestId []byte) (*pb.HistoryResponse, error) { store.log.Info(fmt.Sprintf("Querying message history with peer %s", selectedPeer)) - connOpt, err := store.h.NewStream(ctx, selectedPeer, StoreID_v20beta3) + connOpt, err := store.h.NewStream(ctx, selectedPeer, StoreID_v20beta4) if err != nil { store.log.Error("Failed to connect to remote peer", err) return nil, err @@ -722,7 +722,7 @@ func (store *WakuStore) Resume(ctx context.Context, pubsubTopic string, peerList } if len(peerList) == 0 { - p, err := utils.SelectPeer(store.h, string(StoreID_v20beta3), store.log) + p, err := utils.SelectPeer(store.h, string(StoreID_v20beta4), store.log) if err != nil { store.log.Info("Error selecting peer: ", err) return -1, ErrNoPeersAvailable @@ -760,7 +760,7 @@ func (store *WakuStore) Stop() { } if store.h != nil { - store.h.RemoveStreamHandler(StoreID_v20beta3) + store.h.RemoveStreamHandler(StoreID_v20beta4) } store.wg.Wait() diff --git a/waku/v2/protocol/store/waku_store_protocol_test.go b/waku/v2/protocol/store/waku_store_protocol_test.go index e8150cea..44a2b50c 100644 --- a/waku/v2/protocol/store/waku_store_protocol_test.go +++ b/waku/v2/protocol/store/waku_store_protocol_test.go @@ -44,7 +44,7 @@ func TestWakuStoreProtocolQuery(t *testing.T) { defer s2.Stop() host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) - err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta3)) + err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta4)) require.NoError(t, err) q := Query{ @@ -89,7 +89,7 @@ func TestWakuStoreProtocolNext(t *testing.T) { require.NoError(t, err) host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) - err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta3)) + err = host2.Peerstore().AddProtocols(host1.ID(), string(StoreID_v20beta4)) require.NoError(t, err) s2 := NewWakuStore(host2, nil, nil, 0, 0, tests.Logger()) diff --git a/waku/v2/rpc/admin.go b/waku/v2/rpc/admin.go index 7230730b..1ce9a2ec 100644 --- a/waku/v2/rpc/admin.go +++ b/waku/v2/rpc/admin.go @@ -59,7 +59,7 @@ func (a *AdminService) PostV1Peers(req *http.Request, args *PeersArgs, reply *Su } func isWakuProtocol(protocol string) bool { - return protocol == string(filter.FilterID_v20beta1) || protocol == string(relay.WakuRelayID_v200) || protocol == string(lightpush.LightPushID_v20beta1) || protocol == string(store.StoreID_v20beta3) + return protocol == string(filter.FilterID_v20beta1) || protocol == string(relay.WakuRelayID_v200) || protocol == string(lightpush.LightPushID_v20beta1) || protocol == string(store.StoreID_v20beta4) } func (a *AdminService) GetV1Peers(req *http.Request, args *GetPeersArgs, reply *PeersReply) error {