mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-13 15:24:46 +00:00
fix: enable store only when WithWakuStore
is used
This commit is contained in:
parent
408b1de802
commit
ea6d5bc7b8
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user