From b242389e05344e795a9a259279ea7848a9b35a90 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 12 Sep 2022 15:58:15 -0400 Subject: [PATCH] chore: remove `--persist-messages` flag --- waku.go | 8 +------- waku/node.go | 15 ++++++--------- waku/options.go | 1 - 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/waku.go b/waku.go index 0540dfa1..befd847d 100644 --- a/waku.go +++ b/waku.go @@ -135,12 +135,6 @@ func main() { Usage: "Use SQLiteDB to persist information", Destination: &options.UseDB, }, - &cli.BoolFlag{ - Name: "persist-messages", - Usage: "Enable message persistence", - Destination: &options.Store.PersistMessages, - Value: false, - }, &cli.BoolFlag{ Name: "persist-peers", Usage: "Enable peer persistence", @@ -219,7 +213,7 @@ func main() { }, &cli.BoolFlag{ Name: "store", - Usage: "Enable relay protocol", + Usage: "Enable store protocol to persist messages", Destination: &options.Store.Enable, }, &cli.BoolFlag{ diff --git a/waku/node.go b/waku/node.go index f90c5de7..996dd38b 100644 --- a/waku/node.go +++ b/waku/node.go @@ -205,15 +205,12 @@ func Execute(options Options) { nodeOpts = append(nodeOpts, node.WithWakuFilter(!options.Filter.DisableFullNode, filter.WithTimeout(options.Filter.Timeout))) } - if options.Store.Enable { - if options.Store.PersistMessages { - nodeOpts = append(nodeOpts, node.WithWakuStore(true, options.Store.ShouldResume)) - 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)) - } else { - nodeOpts = append(nodeOpts, node.WithWakuStore(false, false)) - } + nodeOpts = append(nodeOpts, node.WithWakuStore(options.Store.Enable, options.Store.ShouldResume)) + if options.Store.Enable && options.UseDB { + 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)) + } if options.LightPush.Enable { diff --git a/waku/options.go b/waku/options.go index 339eda6c..d8c475ff 100644 --- a/waku/options.go +++ b/waku/options.go @@ -83,7 +83,6 @@ type LightpushOptions struct { // node and provide message history to nodes that ask for it. type StoreOptions struct { Enable bool - PersistMessages bool ShouldResume bool RetentionTime time.Duration RetentionMaxMessages int