@@ -154,7 +154,7 @@ type Waku struct {
154
154
155
155
bandwidthCounter * metrics.BandwidthCounter
156
156
157
- protectedTopicStore * persistence.ProtectedTopicsStore
157
+ protectedTopicStore persistence.ProtectedTopics
158
158
159
159
sendQueue * publish.MessageQueue
160
160
@@ -221,7 +221,7 @@ func newTTLCache() *ttlcache.Cache[gethcommon.Hash, bool] {
221
221
}
222
222
223
223
// New creates a WakuV2 client ready to communicate through the LibP2P network.
224
- func New (nodeKey * ecdsa.PrivateKey , cfg * Config , logger * zap.Logger , appDB * sql. DB , ts timesource.TimeSource , onHistoricMessagesRequestFailed func ([]byte , peer.AddrInfo , error ), onPeerStats func (types.ConnStatus )) (* Waku , error ) {
224
+ func New (nodeKey * ecdsa.PrivateKey , cfg * Config , logger * zap.Logger , protectedTopicsPersistence persistence. ProtectedTopics , ts timesource.TimeSource , onHistoricMessagesRequestFailed func ([]byte , peer.AddrInfo , error ), onPeerStats func (types.ConnStatus )) (* Waku , error ) {
225
225
var err error
226
226
if logger == nil {
227
227
logger , err = zap .NewDevelopment ()
@@ -244,7 +244,6 @@ func New(nodeKey *ecdsa.PrivateKey, cfg *Config, logger *zap.Logger, appDB *sql.
244
244
ctx , cancel := context .WithCancel (context .Background ())
245
245
246
246
waku := & Waku {
247
- appDB : appDB ,
248
247
cfg : cfg ,
249
248
privateKeys : make (map [string ]* ecdsa.PrivateKey ),
250
249
symKeys : make (map [string ][]byte ),
@@ -267,6 +266,7 @@ func New(nodeKey *ecdsa.PrivateKey, cfg *Config, logger *zap.Logger, appDB *sql.
267
266
onPeerStats : onPeerStats ,
268
267
onlineChecker : onlinechecker .NewDefaultOnlineChecker (false ).(* onlinechecker.DefaultOnlineChecker ),
269
268
sendQueue : publish .NewMessageQueue (1000 , cfg .UseThrottledPublish ),
269
+ protectedTopicStore : protectedTopicsPersistence ,
270
270
}
271
271
272
272
waku .filters = common .NewFilters (waku .cfg .DefaultShardPubsubTopic , waku .logger )
@@ -348,13 +348,6 @@ func New(nodeKey *ecdsa.PrivateKey, cfg *Config, logger *zap.Logger, appDB *sql.
348
348
opts = append (opts , node .WithLightPush (lightpush .WithRateLimiter (5 , 10 )))
349
349
}
350
350
351
- if appDB != nil {
352
- waku .protectedTopicStore , err = persistence .NewProtectedTopicsStore (logger , appDB )
353
- if err != nil {
354
- return nil , err
355
- }
356
- }
357
-
358
351
if cfg .EnablePeerExchangeServer {
359
352
opts = append (opts , node .WithPeerExchange (peer_exchange .WithRateLimiter (1 , 1 )))
360
353
}
@@ -1399,13 +1392,6 @@ func (w *Waku) Stop() error {
1399
1392
1400
1393
w .node .Stop ()
1401
1394
1402
- if w .protectedTopicStore != nil {
1403
- err := w .protectedTopicStore .Close ()
1404
- if err != nil {
1405
- return err
1406
- }
1407
- }
1408
-
1409
1395
close (w .goingOnline )
1410
1396
w .wg .Wait ()
1411
1397
0 commit comments