Skip to content

Commit ea6d5bc

Browse files
committed
fix: enable store only when WithWakuStore is used
1 parent 408b1de commit ea6d5bc

File tree

9 files changed

+9
-11
lines changed

9 files changed

+9
-11
lines changed

waku/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ func Execute(options Options) {
225225
nodeOpts = append(nodeOpts, node.WithWakuFilter(!options.Filter.DisableFullNode, filter.WithTimeout(options.Filter.Timeout)))
226226
}
227227

228-
nodeOpts = append(nodeOpts, node.WithWakuStore(options.Store.Enable, options.Store.ResumeNodes...))
229228
if options.Store.Enable {
229+
nodeOpts = append(nodeOpts, node.WithWakuStore(options.Store.ResumeNodes...))
230230
dbStore, err := persistence.NewDBStore(logger, persistence.WithDB(db), persistence.WithRetentionPolicy(options.Store.RetentionMaxMessages, options.Store.RetentionTime))
231231
failOnErr(err, "DBStore")
232232
nodeOpts = append(nodeOpts, node.WithMessageProvider(dbStore))

waku/v2/node/connectedness_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestConnectionStatusChanges(t *testing.T) {
8080
node3, err := New(ctx,
8181
WithHostAddress(hostAddr3),
8282
WithWakuRelay(),
83-
WithWakuStore(false),
83+
WithWakuStore(),
8484
WithMessageProvider(dbStore),
8585
)
8686
require.NoError(t, err)

waku/v2/node/wakunode2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (w *WakuNode) Start() error {
341341
}
342342

343343
// Subscribe store to topic
344-
if w.opts.storeMsgs {
344+
if w.opts.enableStore {
345345
w.log.Info("Subscribing store to broadcaster")
346346
w.bcaster.Register(nil, w.store.MessageChannel())
347347
}

waku/v2/node/wakunode2_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func TestDecoupledStoreFromRelay(t *testing.T) {
192192
wakuNode2, err := New(ctx,
193193
WithHostAddress(hostAddr2),
194194
WithWakuFilter(false),
195-
WithWakuStore(true),
195+
WithWakuStore(),
196196
WithMessageProvider(dbStore),
197197
)
198198
require.NoError(t, err)

waku/v2/node/wakuoptions.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ type WakuNodeParameters struct {
6767

6868
enableStore bool
6969
enableSwap bool
70-
storeMsgs bool
7170
resumeNodes []multiaddr.Multiaddr
7271
messageProvider store.MessageProvider
7372

@@ -319,10 +318,9 @@ func WithWakuFilter(fullNode bool, filterOpts ...filter.Option) WakuNodeOption {
319318
// WithWakuStore enables the Waku V2 Store protocol and if the messages should
320319
// be stored or not in a message provider. If resumeNodes are specified, the
321320
// store will attempt to resume message history using those nodes
322-
func WithWakuStore(shouldStoreMessages bool, resumeNodes ...multiaddr.Multiaddr) WakuNodeOption {
321+
func WithWakuStore(resumeNodes ...multiaddr.Multiaddr) WakuNodeOption {
323322
return func(params *WakuNodeParameters) error {
324323
params.enableStore = true
325-
params.storeMsgs = shouldStoreMessages
326324
params.resumeNodes = resumeNodes
327325
return nil
328326
}

waku/v2/node/wakuoptions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestWakuOptions(t *testing.T) {
4242
WithWakuRelay(),
4343
WithWakuFilter(true),
4444
WithDiscoveryV5(123, nil, false),
45-
WithWakuStore(true),
45+
WithWakuStore(),
4646
WithMessageProvider(&persistence.DBStore{}),
4747
WithLightPush(),
4848
WithKeepAlive(time.Hour),

waku/v2/rest/waku_rest_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
func TestWakuRest(t *testing.T) {
13-
options := node.WithWakuStore(false)
13+
options := node.WithWakuStore()
1414
n, err := node.New(context.Background(), options)
1515
require.NoError(t, err)
1616

waku/v2/rpc/store_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
func makeStoreService(t *testing.T) *StoreService {
13-
options := node.WithWakuStore(false)
13+
options := node.WithWakuStore()
1414
n, err := node.New(context.Background(), options)
1515
require.NoError(t, err)
1616
err = n.Start()

waku/v2/rpc/waku_rpc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
func TestWakuRpc(t *testing.T) {
13-
options := node.WithWakuStore(false)
13+
options := node.WithWakuStore()
1414
n, err := node.New(context.Background(), options)
1515
require.NoError(t, err)
1616

0 commit comments

Comments
 (0)