diff --git a/waku/node.go b/waku/node.go index 48f81d11..0599bbe3 100644 --- a/waku/node.go +++ b/waku/node.go @@ -225,8 +225,8 @@ func Execute(options Options) { nodeOpts = append(nodeOpts, node.WithWakuFilter(!options.Filter.DisableFullNode, filter.WithTimeout(options.Filter.Timeout))) } - nodeOpts = append(nodeOpts, node.WithWakuStore(options.Store.Enable, options.Store.ResumeNodes...)) if options.Store.Enable { + nodeOpts = append(nodeOpts, node.WithWakuStore(options.Store.ResumeNodes...)) dbStore, err := persistence.NewDBStore(logger, persistence.WithDB(db), persistence.WithRetentionPolicy(options.Store.RetentionMaxMessages, options.Store.RetentionTime)) failOnErr(err, "DBStore") nodeOpts = append(nodeOpts, node.WithMessageProvider(dbStore)) diff --git a/waku/v2/node/connectedness_test.go b/waku/v2/node/connectedness_test.go index 88b80237..c53e6522 100644 --- a/waku/v2/node/connectedness_test.go +++ b/waku/v2/node/connectedness_test.go @@ -80,7 +80,7 @@ func TestConnectionStatusChanges(t *testing.T) { node3, err := New(ctx, WithHostAddress(hostAddr3), WithWakuRelay(), - WithWakuStore(false), + WithWakuStore(), WithMessageProvider(dbStore), ) require.NoError(t, err) diff --git a/waku/v2/node/wakunode2.go b/waku/v2/node/wakunode2.go index 9313be43..c68e775d 100644 --- a/waku/v2/node/wakunode2.go +++ b/waku/v2/node/wakunode2.go @@ -341,7 +341,7 @@ func (w *WakuNode) Start() error { } // Subscribe store to topic - if w.opts.storeMsgs { + if w.opts.enableStore { w.log.Info("Subscribing store to broadcaster") w.bcaster.Register(nil, w.store.MessageChannel()) } diff --git a/waku/v2/node/wakunode2_test.go b/waku/v2/node/wakunode2_test.go index be22d7fc..eba3a602 100644 --- a/waku/v2/node/wakunode2_test.go +++ b/waku/v2/node/wakunode2_test.go @@ -192,7 +192,7 @@ func TestDecoupledStoreFromRelay(t *testing.T) { wakuNode2, err := New(ctx, WithHostAddress(hostAddr2), WithWakuFilter(false), - WithWakuStore(true), + WithWakuStore(), WithMessageProvider(dbStore), ) require.NoError(t, err) diff --git a/waku/v2/node/wakuoptions.go b/waku/v2/node/wakuoptions.go index e64befcd..267d4661 100644 --- a/waku/v2/node/wakuoptions.go +++ b/waku/v2/node/wakuoptions.go @@ -67,7 +67,6 @@ type WakuNodeParameters struct { enableStore bool enableSwap bool - storeMsgs bool resumeNodes []multiaddr.Multiaddr messageProvider store.MessageProvider @@ -319,10 +318,9 @@ func WithWakuFilter(fullNode bool, filterOpts ...filter.Option) WakuNodeOption { // WithWakuStore enables the Waku V2 Store protocol and if the messages should // be stored or not in a message provider. If resumeNodes are specified, the // store will attempt to resume message history using those nodes -func WithWakuStore(shouldStoreMessages bool, resumeNodes ...multiaddr.Multiaddr) WakuNodeOption { +func WithWakuStore(resumeNodes ...multiaddr.Multiaddr) WakuNodeOption { return func(params *WakuNodeParameters) error { params.enableStore = true - params.storeMsgs = shouldStoreMessages params.resumeNodes = resumeNodes return nil } diff --git a/waku/v2/node/wakuoptions_test.go b/waku/v2/node/wakuoptions_test.go index d1dca472..26082cdb 100644 --- a/waku/v2/node/wakuoptions_test.go +++ b/waku/v2/node/wakuoptions_test.go @@ -42,7 +42,7 @@ func TestWakuOptions(t *testing.T) { WithWakuRelay(), WithWakuFilter(true), WithDiscoveryV5(123, nil, false), - WithWakuStore(true), + WithWakuStore(), WithMessageProvider(&persistence.DBStore{}), WithLightPush(), WithKeepAlive(time.Hour), diff --git a/waku/v2/rest/waku_rest_test.go b/waku/v2/rest/waku_rest_test.go index 82056af3..79cc6adb 100644 --- a/waku/v2/rest/waku_rest_test.go +++ b/waku/v2/rest/waku_rest_test.go @@ -10,7 +10,7 @@ import ( ) func TestWakuRest(t *testing.T) { - options := node.WithWakuStore(false) + options := node.WithWakuStore() n, err := node.New(context.Background(), options) require.NoError(t, err) diff --git a/waku/v2/rpc/store_test.go b/waku/v2/rpc/store_test.go index 9c28fa31..2ff30341 100644 --- a/waku/v2/rpc/store_test.go +++ b/waku/v2/rpc/store_test.go @@ -10,7 +10,7 @@ import ( ) func makeStoreService(t *testing.T) *StoreService { - options := node.WithWakuStore(false) + options := node.WithWakuStore() n, err := node.New(context.Background(), options) require.NoError(t, err) err = n.Start() diff --git a/waku/v2/rpc/waku_rpc_test.go b/waku/v2/rpc/waku_rpc_test.go index d6e8192d..9fc6eeb9 100644 --- a/waku/v2/rpc/waku_rpc_test.go +++ b/waku/v2/rpc/waku_rpc_test.go @@ -10,7 +10,7 @@ import ( ) func TestWakuRpc(t *testing.T) { - options := node.WithWakuStore(false) + options := node.WithWakuStore() n, err := node.New(context.Background(), options) require.NoError(t, err)